Allocator bench - bench of various memory allocators

Overview

To run benchmarks

  1. Install lockless from https://locklessinc.com/downloads/ in lockless_allocator path make
  2. Install Hoard from https://github.com/emeryberger/Hoard in Hoard and make
  3. Run ruby make_jemallocs.rb
  4. Run ruby make_tcmallocs.rb # You need to install libunwind-dev before
  5. Run ruby make_mimalloc.rb
  6. Run ruby test_all.rb
  7. Run STRESS_THREAD=10 ruby test_all.rb

Results: (current)

Use STRESS_THREADS=N to simulate multi threaded ruby behavior

8 threads

[email protected] allocator_bench % STRESS_THREADS=8 ruby test_all.rb
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
built-in mem: 186336 duration: 3.422897896
built-in mem (MALLOC_ARENA_MAX=2): 135780 duration: 3.492815563
mimalloc master: 236204 duration: 2.947209624
rpmalloc master: 291428 duration: 2.823917527
tcmalloc 2.0 mem: 142860 duration: 2.796963668
tcmalloc 2.1 mem: 134952 duration: 2.9891215
tcmalloc 2.2 mem: 131860 duration: 2.965217507
tcmalloc 2.3 mem: 132268 duration: 2.992975175
tcmalloc 2.4 mem: 141756 duration: 2.817269882
tcmalloc 2.5 mem: 136376 duration: 2.763516053
tcmalloc 2.6 mem: 135892 duration: 2.837330961
tcmalloc 2.6.1 mem: 138776 duration: 2.800292649
tcmalloc 2.6.2 mem: 133392 duration: 2.785083378
tcmalloc 2.6.3 mem: 128448 duration: 2.870347233
tcmalloc 2.7 mem: 134840 duration: 2.816580265
jemalloc 3.5.1 mem: 153808 duration: 2.98163907
jemalloc 3.6.0 mem: 139564 duration: 3.122444062
jemalloc 4.0.0 mem: 151132 duration: 3.001511518
jemalloc 4.0.1 mem: 152276 duration: 3.017984175
jemalloc 4.0.2 mem: 150684 duration: 2.993723311
jemalloc 4.0.3 mem: 157552 duration: 2.955524769
jemalloc 4.0.4 mem: 153460 duration: 2.995114601
jemalloc 4.1.0 mem: 148816 duration: 2.962291218
jemalloc 4.1.1 mem: 146660 duration: 2.951603234
jemalloc 4.2.0 mem: 147800 duration: 2.956029203
jemalloc 4.2.1 mem: 148324 duration: 2.968610441
jemalloc 4.3.0 mem: 169020 duration: 3.110291342
jemalloc 4.3.1 mem: 151936 duration: 2.967231767
jemalloc 4.4.0 mem: 160780 duration: 2.977113841
jemalloc 4.5.0 mem: 158028 duration: 2.949980599
jemalloc 5.0.0 mem: 157076 duration: 3.068324983
jemalloc 5.0.1 mem: 169572 duration: 2.905734288
jemalloc 5.1.0 mem: 153852 duration: 2.925958087
jemalloc 5.2.0 mem: 162008 duration: 2.837378225
jemalloc 5.2.1 mem: 155912 duration: 2.922026484
lockless 1.4 mem: 249540 duration: 2.858882662
Hoard HEAD mem: 182500 duration: 2.988038568

Single threaded

[email protected] allocator_bench % STRESS_THREADS=1 ruby test_all.rb
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
built-in mem: 169444 duration: 3.295604446
built-in mem (MALLOC_ARENA_MAX=2): 162400 duration: 3.309020006
mimalloc master: 143520 duration: 3.216014001
rpmalloc master: 158732 duration: 3.183002545
tcmalloc 2.0 mem: 137736 duration: 3.21834025
tcmalloc 2.1 mem: 138532 duration: 3.199263054
tcmalloc 2.2 mem: 171124 duration: 2.793094939
tcmalloc 2.3 mem: 140144 duration: 3.157911078
tcmalloc 2.4 mem: 169384 duration: 2.777076104
tcmalloc 2.5 mem: 169816 duration: 2.703555291
tcmalloc 2.6 mem: 172612 duration: 2.619339545
tcmalloc 2.6.1 mem: 172512 duration: 2.601444421
tcmalloc 2.6.2 mem: 144872 duration: 2.887256198
tcmalloc 2.6.3 mem: 159620 duration: 2.526488765
tcmalloc 2.7 mem: 173096 duration: 2.619000445
jemalloc 3.5.1 mem: 144348 duration: 3.04128121
jemalloc 3.6.0 mem: 144320 duration: 3.053938303
jemalloc 4.0.0 mem: 182760 duration: 3.016305146
jemalloc 4.0.1 mem: 169596 duration: 2.972724988
jemalloc 4.0.2 mem: 168892 duration: 2.928217891
jemalloc 4.0.3 mem: 168924 duration: 2.952081469
jemalloc 4.0.4 mem: 161744 duration: 2.820295919
jemalloc 4.1.0 mem: 169072 duration: 2.915838045
jemalloc 4.1.1 mem: 169064 duration: 2.949833676
jemalloc 4.2.0 mem: 179084 duration: 2.922669411
jemalloc 4.2.1 mem: 169128 duration: 2.900649117
jemalloc 4.3.0 mem: 176408 duration: 3.083000318
jemalloc 4.3.1 mem: 168748 duration: 2.90019844
jemalloc 4.4.0 mem: 168928 duration: 2.896176489
jemalloc 4.5.0 mem: 174472 duration: 2.785766161
jemalloc 5.0.0 mem: 149940 duration: 2.896406334
jemalloc 5.0.1 mem: 150204 duration: 2.837875746
jemalloc 5.1.0 mem: 148476 duration: 2.824247363
jemalloc 5.2.0 mem: 168224 duration: 2.763762322
jemalloc 5.2.1 mem: 149664 duration: 2.930834257
lockless 1.4 mem: 164468 duration: 2.873501934
Hoard HEAD mem: 174396 duration: 2.903436464

Results: (old)

[email protected] allocator_bench % ruby test_all.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
built-in mem: 136560 duration: 4.92845984
Using the Hoard memory allocator (http://www.hoard.org), version 3.12.0
Using the Hoard memory allocator (http://www.hoard.org), version 3.12.0
Using the Hoard memory allocator (http://www.hoard.org), version 3.12.0
Using the Hoard memory allocator (http://www.hoard.org), version 3.12.0
Hoard HEAD mem: 167772 duration: 4.231493358
lockless 1.4 mem: 166860 duration: 3.567809758
tcmalloc 2.0 mem: 138608 duration: 3.96352459
tcmalloc 2.1 mem: 145676 duration: 3.821032815
tcmalloc 2.2 mem: 141204 duration: 3.830105653
tcmalloc 2.3 mem: 139096 duration: 3.777037605
tcmalloc 2.4 mem: 137548 duration: 3.826598715
tcmalloc 2.5 mem: 139524 duration: 3.825563646
tcmalloc 2.6 mem: 141256 duration: 3.857502124
tcmalloc 2.6.1 mem: 141500 duration: 3.778023667
tcmalloc 2.6.2 mem: 141244 duration: 3.798630141
tcmalloc 2.6.3 mem: 140320 duration: 3.824998923
tcmalloc 2.7 mem: 143192 duration: 3.726972205
jemalloc 3.0.0 mem: 141232 duration: 4.177167928
jemalloc 3.1.0 mem: 162304 duration: 3.939940393
jemalloc 3.2.0 mem: 165188 duration: 3.929158876
jemalloc 3.3.0 mem: 165164 duration: 4.135042063
jemalloc 3.3.1 mem: 153676 duration: 4.08339298
jemalloc 3.4.0 mem: 142332 duration: 4.287041471
jemalloc 3.4.1 mem: 165240 duration: 4.025545814
jemalloc 3.5.0 mem: 133892 duration: 4.065554619
jemalloc 3.5.1 mem: 165216 duration: 4.079860268
jemalloc 3.6.0 mem: 165164 duration: 4.233464591
jemalloc 4.0.0 mem: 141336 duration: 4.574956268
jemalloc 4.0.1 mem: 170944 duration: 4.248128008
jemalloc 4.0.2 mem: 177168 duration: 4.329534696
jemalloc 4.0.3 mem: 173996 duration: 3.920414509
jemalloc 4.0.4 mem: 166488 duration: 4.043237997
jemalloc 4.1.0 mem: 144080 duration: 4.084126294
jemalloc 4.1.1 mem: 140752 duration: 4.122630669
jemalloc 4.2.0 mem: 141840 duration: 4.434104776
jemalloc 4.2.1 mem: 142844 duration: 4.346471957
jemalloc 4.3.0 mem: 176972 duration: 4.883788911
jemalloc 4.3.1 mem: 142052 duration: 4.234083442
jemalloc 4.4.0 mem: 142344 duration: 4.159591159
jemalloc 4.5.0 mem: 139484 duration: 3.954587993
jemalloc 5.0.0 mem: 166592 duration: 4.013335086
jemalloc 5.0.1 mem: 173500 duration: 3.979304747
[email protected] allocators % ruby test_all.rb
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
built-in mem: 177816 duration: 5.463205008
Hoard 3.12 mem: 191836 duration: 4.526371788
lockless 1.3 mem: 196888 duration: 3.689470492
tcmalloc 2.0 mem: 177840 duration: 4.184403986
tcmalloc 2.1 mem: 178952 duration: 4.047054641
tcmalloc 2.2 mem: 180420 duration: 4.021828904
tcmalloc 2.3 mem: 179756 duration: 3.940098988
tcmalloc 2.4 mem: 168828 duration: 4.073669654
tcmalloc 2.5 mem: 171492 duration: 4.087337723
jemalloc 3.0.0 mem: 171652 duration: 4.250548191
jemalloc 3.1.0 mem: 172364 duration: 4.200444839
jemalloc 3.2.0 mem: 176748 duration: 4.249052335
jemalloc 3.3.0 mem: 177104 duration: 4.173927908
jemalloc 3.3.1 mem: 177476 duration: 4.200211943
jemalloc 3.4.0 mem: 176948 duration: 4.246032144
jemalloc 3.4.1 mem: 177436 duration: 4.334329763
jemalloc 3.5.0 mem: 177416 duration: 4.310483395
jemalloc 3.5.1 mem: 177148 duration: 4.314614055
jemalloc 3.6.0 mem: 176984 duration: 4.387391573
jemalloc 4.0.0 mem: 192256 duration: 4.594605504
jemalloc 4.0.1 mem: 185760 duration: 4.415316793
jemalloc 4.0.2 mem: 191228 duration: 4.264772339
jemalloc 4.0.3 mem: 192276 duration: 4.406336821
jemalloc 4.0.4 mem: 193844 duration: 4.292252613
jemalloc 4.1.0 mem: 184900 duration: 4.185297596
jemalloc 4.1.1 mem: 185212 duration: 4.174412318
jemalloc 4.2.0 mem: 185148 duration: 4.142911436
jemalloc 4.2.1 mem: 189636 duration: 4.116592894
jemalloc 4.3.0 mem: 230164 duration: 7.376474329
jemalloc 4.3.1 mem: 186060 duration: 4.103093871
jemalloc 4.4.0 mem: 182524 duration: 4.137382241
STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.

memory The C++ STL allocator model has various flaws. For example, they are fixed to a certain type, because they are almost necessarily required to b

Jonathan Müller 1.1k May 9, 2022
STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.

STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.

Jonathan Müller 1k Dec 2, 2021
Alloc-test - Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical

Alloc-test - Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical

null 36 Mar 17, 2022
The Hoard Memory Allocator: A Fast, Scalable, and Memory-efficient Malloc for Linux, Windows, and Mac.

The Hoard Memory Allocator Copyright (C) 1998-2020 by Emery Berger The Hoard memory allocator is a fast, scalable, and memory-efficient memory allocat

Emery Berger 882 May 13, 2022
Mesh - A memory allocator that automatically reduces the memory footprint of C/C++ applications.

Mesh: Compacting Memory Management for C/C++ Mesh is a drop in replacement for malloc(3) that can transparently recover from memory fragmentation with

PLASMA @ UMass 1.4k May 7, 2022
Mimalloc-bench - Suite for benchmarking malloc implementations.

Mimalloc-bench Suite for benchmarking malloc implementations, originally developed for benchmarking mimalloc. Collection of various benchmarks from th

Daan 141 May 11, 2022
Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

rpmalloc - General Purpose Memory Allocator This library provides a public domain cross platform lock free thread caching 16-byte aligned memory alloc

Mattias Jansson 1.5k May 10, 2022
A tiny portable C89 memory allocator

mem A tiny portable C89 memory allocator. Usage This is a single-header library. You must include this file alongside #define MEM_IMPLEMENTATION in on

null 8 Mar 31, 2022
Malloc Lab: simple memory allocator using sorted segregated free list

LAB 6: Malloc Lab Main Files mm.{c,h} - Your solution malloc package. mdriver.c - The malloc driver that tests your mm.c file short{1,2}-bal.rep - T

null 1 Feb 28, 2022
mimalloc is a compact general purpose allocator with excellent performance.

mimalloc mimalloc (pronounced "me-malloc") is a general purpose allocator with excellent performance characteristics. Initially developed by Daan Leij

Microsoft 6.7k May 13, 2022
Hardened malloc - Hardened allocator designed for modern systems

Hardened malloc - Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.

GrapheneOS 715 May 12, 2022
Snmalloc - Message passing based allocator

snmalloc snmalloc is a high-performance allocator. snmalloc can be used directly in a project as a header-only C++ library, it can be LD_PRELOADed on

Microsoft 914 May 13, 2022
MMCTX (Memory Management ConTeXualizer), is a tiny (< 300 lines), single header C99 library that allows for easier memory management by implementing contexts that remember allocations for you and provide freeall()-like functionality.

MMCTX (Memory Management ConTeXualizer), is a tiny (< 300 lines), single header C99 library that allows for easier memory management by implementing contexts that remember allocations for you and provide freeall()-like functionality.

A.P. Jo. 4 Oct 2, 2021
Memory-dumper - A tool for dumping files from processes memory

What is memory-dumper memory-dumper is a tool for dumping files from process's memory. The main purpose is to find patterns inside the process's memor

Alexander Nestorov 29 Feb 5, 2022
OpenXenium JTAG and Flash Memory programmer

OpenXenium JTAG and Flash Memory programmer * Read: "Home Brew" on ORIGINAL XBOX - a detailed article on why and how * The tools in this repo will all

Koos du Preez 25 Feb 14, 2022
manually map driver for a signed driver memory space

smap manually map driver for a signed driver memory space credits https://github.com/btbd/umap tested system Windows 10 Education 20H2 UEFI installati

ekknod 71 Apr 9, 2022
Memory instrumentation tool for android app&game developers.

Overview LoliProfiler is a C/C++ memory profiling tool for Android games and applications. LoliProfiler supports profiling debuggable applications out

Tencent 416 May 13, 2022
A single file drop-in memory leak tracking solution for C++ on Windows

MemLeakTracker A single file drop-in memory leak tracking solution for C++ on Windows This small piece of code allows for global memory leak tracking

null 22 Apr 23, 2022
Dump the memory of a PPL with a userland exploit

PPLdump This tool implements a userland exploit that was initially discussed by James Forshaw (a.k.a. @tiraniddo) - in this blog post - for dumping th

Clément Labro 546 May 14, 2022