You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -80,219 +80,98 @@ The `malloc_cmp_test` build target will build 2 different versions of the test/t
80
80
The following test was run in an Ubuntu 20.04.3 LTS (Focal Fossa) for ARM64 docker container with libc version 2.31-0ubuntu9.2 on a MacOS host. The kernel used was `Linux f7f23ca7dc44 5.10.76-linuxkit`.
81
81
82
82
```
83
-
Running IsoAlloc Performance Test
84
-
83
+
IsoAlloc
85
84
build/tests
86
-
iso_alloc/iso_free 1441616 tests completed in 0.168293 seconds
87
-
iso_calloc/iso_free 1441616 tests completed in 0.171274 seconds
88
-
iso_realloc/iso_free 1441616 tests completed in 0.231350 seconds
89
-
90
-
Running glibc/ptmalloc Performance Test
91
-
92
-
malloc/free 1441616 tests completed in 0.166813 seconds
93
-
calloc/free 1441616 tests completed in 0.223232 seconds
94
-
realloc/free 1441616 tests completed in 0.306684 seconds
malloc/free 1441616 tests completed in 0.227757 seconds
128
-
calloc/free 1441616 tests completed in 0.204610 seconds
129
-
realloc/free 1441616 tests completed in 0.258962 seconds
85
+
iso_alloc/iso_free 1834784 tests completed in 0.081202 seconds
86
+
iso_calloc/iso_free 1834784 tests completed in 1.041517 seconds
87
+
iso_realloc/iso_free 1834784 tests completed in 0.828665 seconds
88
+
89
+
jemalloc
90
+
LD_PRELOAD=./libjemalloc.so build/tests
91
+
iso_alloc/iso_free 1834784 tests completed in 0.084586 seconds
92
+
iso_calloc/iso_free 1834784 tests completed in 1.461562 seconds
93
+
iso_realloc/iso_free 1834784 tests completed in 0.779396 seconds
94
+
95
+
scudo
96
+
LD_PRELOAD=./libscudo.so build/malloc_tests
97
+
malloc/free 1834784 tests completed in 0.717936 seconds
98
+
calloc/free 1834784 tests completed in 2.706141 seconds
99
+
realloc/free 1834784 tests completed in 1.840283 seconds
100
+
101
+
system malloc
102
+
malloc/free 1834784 tests completed in 0.662565 seconds
103
+
calloc/free 1834784 tests completed in 2.728955 seconds
104
+
realloc/free 1834784 tests completed in 1.943556 seconds
130
105
131
106
```
132
107
133
-
The same test run on an AWS t2.xlarge Ubuntu 20.04 instance with 4 `Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz` CPUs and 16 gb of memory:
134
-
135
-
```
136
-
Running IsoAlloc Performance Test
137
-
138
-
iso_alloc/iso_free 1441616 tests completed in 0.147336 seconds
139
-
iso_calloc/iso_free 1441616 tests completed in 0.161482 seconds
140
-
iso_realloc/iso_free 1441616 tests completed in 0.244981 seconds
141
-
142
-
Running glibc malloc Performance Test
143
-
144
-
malloc/free 1441616 tests completed in 0.182437 seconds
145
-
calloc/free 1441616 tests completed in 0.246065 seconds
146
-
realloc/free 1441616 tests completed in 0.332292 seconds
147
-
```
148
-
149
-
Here is the same test as above on Mac OS 12.1
150
-
151
-
```
152
-
Running IsoAlloc Performance Test
153
-
154
-
build/tests
155
-
iso_alloc/iso_free 1441616 tests completed in 0.149818 seconds
156
-
iso_calloc/iso_free 1441616 tests completed in 0.183772 seconds
157
-
iso_realloc/iso_free 1441616 tests completed in 0.274413 seconds
158
-
159
-
Running system malloc Performance Test
160
-
161
-
build/malloc_tests
162
-
malloc/free 1441616 tests completed in 0.084803 seconds
163
-
calloc/free 1441616 tests completed in 0.194901 seconds
164
-
realloc/free 1441616 tests completed in 0.240934 seconds
165
-
```
166
-
167
108
This same test can be used with the `perf` utility to measure basic stats like page faults and CPU utilization using both heap implementations. The output below is on the same AWS t2.xlarge instance as above.
168
109
169
110
```
170
-
$ perf stat build/tests
111
+
$ sudo perf stat build/tests
171
112
172
-
iso_alloc/iso_free 1441616 tests completed in 0.416603 seconds
173
-
iso_calloc/iso_free 1441616 tests completed in 0.575822 seconds
174
-
iso_realloc/iso_free 1441616 tests completed in 0.679546 seconds
113
+
iso_alloc/iso_free 1834784 tests completed in 0.075247 seconds
114
+
iso_calloc/iso_free 1834784 tests completed in 1.100221 seconds
115
+
iso_realloc/iso_free 1834784 tests completed in 0.901481 seconds
175
116
176
117
Performance counter stats for 'build/tests':
177
118
178
-
1709.07 msec task-clock # 1.000 CPUs utilized
179
-
7 context-switches # 0.004 K/sec
180
-
0 cpu-migrations # 0.000 K/sec
181
-
145562 page-faults # 0.085 M/sec
182
-
183
-
1.709414837 seconds time elapsed
184
-
185
-
1.405068000 seconds user
186
-
0.304239000 seconds sys
187
-
188
-
$ perf stat build/malloc_tests
189
-
190
-
malloc/free 1441616 tests completed in 0.359380 seconds
191
-
calloc/free 1441616 tests completed in 0.569044 seconds
192
-
realloc/free 1441616 tests completed in 0.597936 seconds
193
-
194
-
Performance counter stats for 'build/malloc_tests':
195
-
196
-
1528.51 msec task-clock # 1.000 CPUs utilized
197
-
5 context-switches # 0.003 K/sec
198
-
0 cpu-migrations # 0.000 K/sec
199
-
433055 page-faults # 0.283 M/sec
200
-
201
-
1.528795324 seconds time elapsed
202
-
203
-
0.724352000 seconds user
204
-
0.804371000 seconds sys
205
-
119
+
2,082,958,624 task-clock # 0.874 CPUs utilized
120
+
26 context-switches # 12.482 /sec
121
+
0 cpu-migrations # 0.000 /sec
122
+
576,000 page-faults # 276.530 K/sec
123
+
<not counted> armv8_pmuv3_0/instructions/ (0.00%)
124
+
10,522,826,144 armv8_pmuv3_1/instructions/ # 1.33 insn per cycle
3,870,559 armv8_pmuv3_1/branch-misses/ # 0.20% of all branches
136
+
137
+
2.382450831 seconds time elapsed
138
+
139
+
1.325971000 seconds user
140
+
1.055181000 seconds sys
206
141
```
207
142
208
-
The following benchmarks were collected from [mimalloc-bench](https://github.com/daanx/mimalloc-bench) with the default configuration of IsoAlloc. As you can see from the data IsoAlloc is competitive with jemalloc, tcmalloc, and glibc/ptmalloc for some benchmarks but clearly falls behind in the Redis benchmark. For any benchmark that IsoAlloc scores poorly on I was able to tweak its build to improve the CPU time and memory consumption. It's worth noting that IsoAlloc was able to stay competitive even with performing many security checks not present in other allocators. Please note these are 'best case' measurements, not averages.
143
+
The following benchmarks were collected from [mimalloc-bench](https://github.com/daanx/mimalloc-bench) with the default configuration of IsoAlloc. As you can see from the data IsoAlloc is competitive with other allocators for some benchmarks but clearly falls behind on others. For any benchmark that IsoAlloc scores poorly on I was able to tweak its build to improve the CPU time and memory consumption. It's worth noting that IsoAlloc was able to stay competitive even with performing many security checks not present in other allocators. Please note these are 'best case' measurements, not averages.
209
144
210
145
```
211
-
# benchmark allocator elapsed rss user sys page-faults page-reclaims
# test alloc time rss user sys page-faults page-reclaims
148
+
cfrac je 02.99 4912 2.99 0.00 0 454
149
+
cfrac mi 03.01 2484 3.00 0.00 0 346
150
+
cfrac iso 05.84 26616 5.75 0.09 0 6502
151
+
152
+
espresso je 02.52 4872 2.50 0.01 0 538
153
+
espresso mi 02.46 3060 2.45 0.01 0 3637
154
+
espresso iso 03.65 69876 3.56 0.09 0 21695
155
+
156
+
barnes je 01.62 60268 1.59 0.02 0 16687
157
+
barnes mi 01.71 57672 1.68 0.02 0 16550
158
+
barnes iso 01.66 74628 1.62 0.03 0 20851
159
+
160
+
gs je 00.16 37592 0.15 0.01 0 5808
161
+
gs mi 00.16 32588 0.13 0.02 0 5109
162
+
gs iso 00.23 71152 0.16 0.07 0 19698
163
+
164
+
larsonN je 1.171 266596 98.81 0.92 0 409842
165
+
larsonN mi 1.016 299768 99.38 0.44 0 83755
166
+
larsonN iso 918.582 126528 99.64 0.37 0 31368
167
+
168
+
rocksdb je 02.48 162424 2.05 0.63 0 38384
169
+
rocksdb mi 02.48 159812 2.04 0.66 0 37464
170
+
rocksdb iso 02.74 197220 2.49 0.55 0 46815
171
+
172
+
redis je 3.180 9496 0.14 0.02 0 1538
173
+
redis mi 3.080 7088 0.12 0.03 0 1256
174
+
redis iso 6.880 52816 0.31 0.05 0 16317
296
175
```
297
176
298
177
IsoAlloc isn't quite ready for performance sensitive server workloads. However it's more than fast enough for client side mobile/desktop applications with risky C/C++ attack surfaces. These environments have threat models similar to what IsoAlloc was designed for.
0 commit comments