diff options
author | Ray Molenkamp <github@lazydodo.com> | 2019-11-13 06:55:39 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2019-11-13 06:55:39 +0300 |
commit | d60a60f0cb85087ddebcb47910847f1a0c4b916c (patch) | |
tree | ced2886d1048b56e2b02c4a24744f4d18b6d079d /source/creator | |
parent | c69872bd2ff31690156ca5c15a54de850d8e17a7 (diff) |
Add support for the TBB allocator on windows.
The heap on windows is single threaded causing it to lag behind linux in performance in allocation heavy multithreaded scenarios, BVH building is a prime example.
See https://developer.blender.org/D6218 for benchmark results
for testing with the allocator enabled/disabled you can set the environment variable TBB_MALLOC_DISABLE_REPLACEMENT=1 to disable the TBB allocator.
Reviewed By: @sergey
Differential Revision: https://developer.blender.org/D6218
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 15 | ||||
-rw-r--r-- | source/creator/creator.c | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 50b4f3edfa9..8a85c75cade 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -81,6 +81,12 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() +if(WITH_TBB) + blender_include_dirs(${TBB_INCLUDE_DIRS}) + link_directories(${LIBDIR}/tbb/lib) +endif() + + if(WITH_PYTHON) blender_include_dirs(../blender/python) add_definitions(-DWITH_PYTHON) @@ -806,6 +812,15 @@ elseif(WIN32) ) endif() + if(WITH_TBB_MALLOC_PROXY) + install( + FILES + ${LIBDIR}/tbb/lib/tbbmalloc.dll + ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll + DESTINATION "." + ) + endif() + if(WITH_CODEC_SNDFILE) install( FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll diff --git a/source/creator/creator.c b/source/creator/creator.c index 3632eb9eb9a..f6c2b707c8f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -29,6 +29,11 @@ # include "utfconv.h" #endif +#if defined(WITH_TBB_MALLOC) && defined(_MSC_VER) +# pragma comment(lib, "tbbmalloc_proxy.lib") +# pragma comment(linker, "/include:__TBB_malloc_proxy") +#endif + #include "MEM_guardedalloc.h" #include "CLG_log.h" |