Closed mingodad closed 3 years ago
Hi, did you specify the build type in CMake? Perhaps it was a debug build? It would be useful to see an example compiler output from:
VERBOSE=1 make
Although the test is so short it might be just noise
By default if you don't specify the build type it doesn't use optimizer flags:
cmake ..
In verbose make output:
[ 21%] Building C object CMakeFiles/libravinojit_static.dir/src/lparser.c.o
/usr/bin/cc -DLUA_USE_LINUX=1 -I/home/xxx/github/ravi/include -march=native -o CMakeFiles/libravinojit_static.dir/src/lparser.c.o -c /home/xxx/github/ravi/src/lparser.c
So to get optimized builds, please set build type like so:
cmake -DCMAKE_BUILD_TYPE=Release ..
Thank you !
Now ravi
built with CMAKE is only 25% slower than ravi
made with cmake.
Is this the expected result ?
/usr/bin/time ravi-cmake fibonacci.ravi
3524578
0.32user 0.00system 0:00.32elapsed 99%CPU (0avgtext+0avgdata 2880maxresident)k
8inputs+0outputs (0major+137minor)pagefaults 0swaps
/usr/bin/time rav-makei fibonacci.ravi
3524578
0.25user 0.00system 0:00.26elapsed 97%CPU (0avgtext+0avgdata 2704maxresident)k
904inputs+0outputs (3major+124minor)pagefaults 0swaps
You shouldn't see any difference - but it may be that the optimizer flags are different. The make build uses -O2. CMake build in my host used -O3.
Also the test you are running isn't big enough to be conclusive.
Some other factors:
The make build doesn't link in the JIT backend. The CMAKE build does unless you disable it.
Just updated my clone of this project and testing ravi build from "make" at the root folder and with cmake in a build folder and testing with the script shown bellow the one done with "make" is more than twice as fast with CMake:
Output: