TeomanDeniz / ft_math

The entire <math.h> library from scratch.
http://maximum-tension.com/
MIT License
15 stars 1 forks source link

Benchmarks. #2

Open aqilc opened 1 year ago

aqilc commented 1 year ago

How does this library compare to the original math.hs in MSVC, MinGW, and Linux CSTDLibs? It looks like you used many bit tricks and optimized this library extensively yourself, but I wonder if it's stopping compiler optimizations or if it can really replace native CSTD math.h libraries in places where performance matters.

TeomanDeniz commented 1 month ago

Modern compilers are indeed has faster functions than my own functions. I agree with that. But it is just a fun project. Or at least if you're writing a kernel, you MUST use codes that written in zero like these instead of using system or compiler functions to create your kernel. Like fdlibm does. So again, it is a fun project. And plus, it was written for École 42 school to show students that they also can create stuff like these.

aqilc commented 1 month ago

That is cool, fun is all you can ask for. I still wonder if this library can actually stack up performance-wise, and if you should use platform specific instructions when they exist, or builtins for that matter. While it's true that you can't use stdlib's math.h for writing kernels, you would use a whole C STDLIB implementation instead of just specific parts like this math library, or just port glib.