From ea9dbd1036a57005227866d0cc2ba5f00e2e7cbd Mon Sep 17 00:00:00 2001 From: daan Date: Mon, 15 Jul 2019 13:19:26 -0700 Subject: [PATCH] set better default options for performance --- CMakeLists.txt | 7 +++++++ ide/vs2017/mimalloc-test-stress.vcxproj | 11 ++++++++++- ide/vs2017/mimalloc-test-stress.vcxproj.filters | 5 ++++- src/memory.c | 4 ++-- src/options.c | 4 ++-- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9de8618..e53df168 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,9 +187,16 @@ target_compile_options(mimalloc-test-stress PRIVATE ${mi_cflags}) target_include_directories(mimalloc-test-stress PRIVATE include) target_link_libraries(mimalloc-test-stress PRIVATE mimalloc-static) +add_executable(mimalloc-test-map-frag test/test-leak.cpp) +target_compile_definitions(mimalloc-test-map-frag PRIVATE ${mi_defines}) +target_compile_options(mimalloc-test-map-frag PRIVATE ${mi_cflags}) +target_include_directories(mimalloc-test-map-frag PRIVATE include) +target_link_libraries(mimalloc-test-map-frag PRIVATE mimalloc-static) + enable_testing() add_test(test_api, mimalloc-test-api) add_test(test_stress, mimalloc-test-stress) +add_test(test_map_frag, mimalloc-test-map-frag) # ----------------------------------------------------------------------------- # Set override properties diff --git a/ide/vs2017/mimalloc-test-stress.vcxproj b/ide/vs2017/mimalloc-test-stress.vcxproj index 5ef92d86..357d3985 100644 --- a/ide/vs2017/mimalloc-test-stress.vcxproj +++ b/ide/vs2017/mimalloc-test-stress.vcxproj @@ -89,6 +89,7 @@ true true ..\..\include + stdcpp17 Console @@ -101,6 +102,7 @@ true true ..\..\include + stdcpp17 Console @@ -116,6 +118,7 @@ true ..\..\include %(PreprocessorDefinitions);NDEBUG + stdcpp17 true @@ -133,6 +136,7 @@ true ..\..\include %(PreprocessorDefinitions);NDEBUG + stdcpp17 true @@ -141,7 +145,12 @@ + + true + true + true + true @@ -152,4 +161,4 @@ - + \ No newline at end of file diff --git a/ide/vs2017/mimalloc-test-stress.vcxproj.filters b/ide/vs2017/mimalloc-test-stress.vcxproj.filters index b857ea52..39162b4e 100644 --- a/ide/vs2017/mimalloc-test-stress.vcxproj.filters +++ b/ide/vs2017/mimalloc-test-stress.vcxproj.filters @@ -18,5 +18,8 @@ Source Files + + Source Files + - + \ No newline at end of file diff --git a/src/memory.c b/src/memory.c index 3a881893..c49b00a9 100644 --- a/src/memory.c +++ b/src/memory.c @@ -314,10 +314,10 @@ void _mi_mem_free(void* p, size_t size, size_t id, mi_stats_t* stats) { // reset: 10x slowdown on malloc-large, decommit: 17x slowdown on malloc-large if (!mi_option_is_enabled(mi_option_large_os_pages)) { if (mi_option_is_enabled(mi_option_eager_region_commit)) { - _mi_os_reset(p, size, stats); // 10x slowdown on malloc-large + //_mi_os_reset(p, size, stats); // 10x slowdown on malloc-large } else { - _mi_os_decommit(p, size, stats); // 17x slowdown on malloc-large + //_mi_os_decommit(p, size, stats); // 17x slowdown on malloc-large } } diff --git a/src/options.c b/src/options.c index 0e0b0556..9f408874 100644 --- a/src/options.c +++ b/src/options.c @@ -34,8 +34,8 @@ typedef struct mi_option_desc_s { static mi_option_desc_t options[_mi_option_last] = { { 0, UNINIT, "page_reset" }, { 0, UNINIT, "cache_reset" }, - { 0, UNINIT, "eager_commit" }, - { 0, UNINIT, "eager_region_commit" }, + { 1, UNINIT, "eager_commit" }, + { 1, UNINIT, "eager_region_commit" }, { 0, UNINIT, "large_os_pages" }, // use large OS pages, use only with eager commit to prevent fragmentation of VMA's { 0, UNINIT, "reset_decommits" }, { 0, UNINIT, "reset_discards" },