set better default options for performance

This commit is contained in:
daan 2019-07-15 13:19:26 -07:00
parent 0196622fff
commit ea9dbd1036
5 changed files with 25 additions and 6 deletions

View File

@ -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

View File

@ -89,6 +89,7 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -101,6 +102,7 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -116,6 +118,7 @@
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);NDEBUG</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -133,6 +136,7 @@
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);NDEBUG</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -141,7 +145,12 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test\test-leak.cpp" />
<ClCompile Include="..\..\test\test-stress.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -152,4 +161,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -18,5 +18,8 @@
<ClCompile Include="..\..\test\test-stress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test-leak.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -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
}
}

View File

@ -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" },