Open wincent opened 1 year ago
Quick test of Hoard, for comparison:
brew tap emeryberger/hoard
brew install --HEAD emeryberger/hoard/libhoard
make clean
make
hoard bin/benchmarks/matcher.lua
Results (relative to wincent/mimalloc
branch) on M3:
Summary of cpu time and (wall time):
best avg sd +/- p (best) (avg) (sd) +/- p
pathological 0.20645 0.21815 0.07995 [-3.6%] 0.025 (0.20715) (0.21876) (0.08035) [-3.5%] 0.025
command-t 0.16663 0.17294 0.05643 [+0.7%] (0.16724) (0.17352) (0.05677) [+0.7%]
chromium (subset) 1.34275 1.35172 0.02076 [-0.8%] 0.0005 (0.28418) (0.28908) (0.01675) [-1.2%] 0.005
chromium (whole) 1.10651 1.11530 0.02674 [-0.1%] (0.12181) (0.12475) (0.01076) [-0.0%]
big (400k) 1.66873 1.68029 0.03942 [-0.1%] (0.18046) (0.18403) (0.01414) [-0.5%]
total 4.49797 4.53841 0.14236 [-0.4%] 0.05 (0.96567) (0.99015) (0.11602) [-1.1%] 0.05
Vendoring from microsoft/mimalloc and specifically the
v2.0.6 tagv2.1.7 tag.mimalloc is a simple allocator focused on performance and it is easy to drop in as a replacement for
malloc()
and friends as described in its README. So as not to bring in a dependency on CMake, we just build thestatic.c
version. Sadly, the performance delta (see numbers below) is not a clear win; the numbers are a bit all over the place. This probably isn't that surprising because most of the heavy memory allocation in Command-T is already micro-managed internally (but simply, with little overhead) using big slabs allocated withmmap()
. Nevertheless, parking this here as a possible idea.I added a script to pull down the release archive and dump it into a directory, because I don't want to use a submodule for this (people installing a Vim plugin from a Git repo shouldn't have to know/worry about whether it needs or uses submodules). Space on disk for this set of files (some of which are obviously redundant in our context) is:
As it is not clear whether this is going to be a great idea or not, it only takes effect if you call
make
withUSE_MIMALLOC
set. You can verify that it actually is overriding the standardmalloc()
etc calls by running a command withMIMALLOC_VERBOSE
, which will cause it to print some extra info out:Impact (unfortunately, a bit inconclusive) on scanner and matcher benchmarks follows. Note that numbers shouldn't be compared across machines because they were produced at different times (for example, the M3 numbers are from a different version of the OS, and the branch was rebased, compared with the other machines).
On mid-2015 MacBook Pro
These numbers are all over the map due to thermal throttling.
M1 MacBook Pro
M3 MacBook Pro
Ryzen 5950X Arch Linux