Skip to content

Instantly share code, notes, and snippets.

@jakedouglas
Created August 5, 2010 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakedouglas/510542 to your computer and use it in GitHub Desktop.
Save jakedouglas/510542 to your computer and use it in GitHub Desktop.
require 'benchmark'
puts Benchmark.measure {
a = []
5000000.times { a << []} # use up some RAM
3000000.times {[]}
}
-O0:
normal: 12.8s
Total: 1097 samples
257 23.4% 23.4% 341 31.1% _gc_sweep
251 22.9% 46.3% 379 34.5% _gc_mark_children
205 18.7% 65.0% 205 18.7% _rb_ary_store
111 10.1% 75.1% 393 35.8% _gc_mark
50 4.6% 79.7% 50 4.6% _rb_special_const_p
35 3.2% 82.9% 35 3.2% _szone_free_definite_size
31 2.8% 85.7% 31 2.8% _add_heap
24 2.2% 87.9% 24 2.2% __setjmp
20 1.8% 89.7% 20 1.8% _add_freelist
20 1.8% 91.5% 20 1.8% _tiny_malloc_from_free_list
threaded: 13.1s
Total: 1119 samples
328 29.3% 29.3% 328 29.3% _semaphore_wait_trap
223 19.9% 49.2% 325 29.0% _gc_mark_children
176 15.7% 65.0% 177 15.8% _rb_ary_store
97 8.7% 73.6% 346 30.9% _gc_mark
46 4.1% 77.7% 46 4.1% _semaphore_wait_signal_trap
43 3.8% 81.6% 43 3.8% _tiny_malloc_from_free_list
38 3.4% 85.0% 38 3.4% _rb_special_const_p
33 2.9% 87.9% 33 2.9% ___mmap
31 2.8% 90.7% 31 2.8% _add_heap
23 2.1% 92.8% 23 2.1% _gc_sweep_heaps
-O2:
normal: 9.2s
Total: 809 samples
301 37.2% 37.2% 583 72.1% _garbage_collect
131 16.2% 53.4% 131 16.2% _rb_ary_store
109 13.5% 66.9% 218 26.9% _gc_mark_children
108 13.3% 80.2% 108 13.3% _gc_mark
29 3.6% 83.8% 29 3.6% _szone_free_definite_size
27 3.3% 87.1% 28 3.5% _add_heap
20 2.5% 89.6% 20 2.5% _tiny_malloc_from_free_list
18 2.2% 91.8% 18 2.2% __setjmp
14 1.7% 93.6% 14 1.7% ___mmap
8 1.0% 94.6% 601 74.3% _rb_eval
threaded: 9.5s
Total: 874 samples
310 35.5% 35.5% 310 35.5% _semaphore_wait_trap
145 16.6% 52.1% 145 16.6% _rb_ary_store
122 14.0% 66.0% 228 26.1% _gc_mark_children
104 11.9% 77.9% 104 11.9% _gc_mark
44 5.0% 83.0% 44 5.0% _semaphore_wait_signal_trap
29 3.3% 86.3% 29 3.3% _add_heap
25 2.9% 89.1% 25 2.9% _gc_sweep_heaps
20 2.3% 91.4% 20 2.3% _tiny_malloc_from_free_list
14 1.6% 93.0% 14 1.6% ___mmap
12 1.4% 94.4% 753 86.2% _rb_eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment