how to compile with nginx?
I want compile with nginx source, but not with .so or .a file i want compile buildin directly in nginx source to get maximum performance.
I dont want configure --with-ld-opt="-lsnmalloc"
I want directly embedded inside nginx compile toolchain. How i can do this?
Thanks and
best regards
I haven't tried, but I would start by adding the .a but built with -DSNMALLOC_IPO=On. This should build a LTO/IPO enabled include, and then you can try that. This is not an option that is in the test harness, and I don't personally use it, so it might or might not work.
An alternative would be to add src/snmalloc/override/malloc.cc
to the build, and enable LTO. If it is a C++ project, then you might want to override new/delete. So you can include:
instead of the malloc.cc unit. The new.cc includes malloc.cc already.
Please, let us know how you get on.
Could you try make patch for nginx
And we could point snmalloc sources at configure level to solve this
I suggest you benchmark with LD_PRELOAD, and if that demonstrates that there is a win in using snmalloc. Removing the PLT indirection will improve performance, but if the different allocators you try are all going via a PLT indirection then it should be a relatively fair comparison to then decide if you want to do additional work to remove the PLT indirection.
Snmalloc will be nice .
I know that very well
So I quickly tried the IPO option it seems to work, but doesn't give any inline above using the .a in the application I used.
cmake -DSNMALLOC_IPO=On .. -DCMAKE_CXX_COMPILER=clang++ -GNinja -DSNMALLOC_STATIC_LIBRARY_PREFIX=""
will build
libsnmallocshim-static.a
which you can add to your build like
clang++ -flto test.cc -O3 libsnmallocshim-static.a -O test
But I don't see any advantage in the disassembly over not using IPO.