Skip to content

Instantly share code, notes, and snippets.

@edward
Created October 29, 2013 13:06
Show Gist options
  • Select an option

  • Save edward/7214270 to your computer and use it in GitHub Desktop.

Select an option

Save edward/7214270 to your computer and use it in GitHub Desktop.
Running benchmarks of context-threaded Ruby vs. normal Ruby. ctruby build with regular ./configure and no special flags. Benchmarks performed on a MacBook Air mid-2011.
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
$ ./ruby -v
ruby 2.1.0dev (2013-10-23 trunk 43398) [x86_64-darwin13.0.0]
$ ruby benchmark/driver.rb --executables="normal_ruby::/opt/boxen/rbenv/shims/ruby; ctruby::/Users/edward/Code/C/ruby/ruby -Ilib:.:.ext/common:.ext/x86_64-darwin13.0.0/" --pattern='bm_' --directory=/Users/edward/Code/C/ruby/benchmark -r 5
preparing benchmark/fasta.output.100000
preparing benchmark/fasta.output.2500000
-----------------------------------------------------------
benchmark results:
Execution time (sec)
name normal_ruby ctruby
app_answer 0.206 0.227
app_aobench 112.314 220.067
app_erb 2.274 4.616
app_factorial 2.303 5.646
app_fib 1.216 2.078
app_mandelbrot 2.316 6.093
app_pentomino 32.636 70.389
app_raise 0.775 1.523
app_strconcat 1.953 5.325
app_tak 1.608 2.866
app_tarai 1.290 2.340
app_uri 1.836 3.385
hash_shift 6.037 0.156
io_file_create 5.496 6.338
io_file_read 4.336 5.473
io_file_write 1.569 2.047
io_select 4.233 5.691
io_select2 9.145 10.620
io_select3 0.234 0.225
loop_for 2.598 5.693
loop_generator 0.945 1.768
loop_times 2.320 5.116
loop_whileloop 1.017 1.884
loop_whileloop2 0.296 0.439
so_ackermann 1.375 2.380
so_array 2.143 4.851
so_binary_trees 13.412 27.378
so_concatenate 7.534 16.212
so_count_words 0.508 0.834
so_exception 0.752 1.494
so_fannkuch 2.933 5.210
so_fasta 3.814 8.254
so_k_nucleotide 2.327 5.388
so_lists 1.293 2.804
so_mandelbrot 4.692 9.185
so_matrix 1.392 3.122
so_meteor_contest 5.561 13.407
so_nbody 3.054 5.692
so_nested_loop 2.040 4.750
so_nsieve 3.912 9.161
so_nsieve_bits 4.138 10.488
so_object 1.630 3.596
so_partial_sums 3.718 6.599
so_pidigits 1.581 3.563
so_random 0.772 1.528
so_reverse_complement 2.536 4.988
so_sieve 1.349 2.884
so_spectralnorm 3.670 8.030
vm1_attr_ivar* 2.046 3.699
vm1_attr_ivar_set* 2.561 4.744
vm1_block* 3.401 7.612
vm1_const* 0.528 1.262
vm1_ensure* 0.302 0.537
vm1_float_simple* 8.102 17.805
vm1_ivar* 1.608 2.339
vm1_ivar_set* 1.950 2.760
vm1_length* 1.166 2.648
vm1_lvar_init* 2.313 12.499
vm1_lvar_set* 3.510 7.086
vm1_neq* 0.844 2.311
vm1_not* 0.415 1.280
vm1_rescue* 0.199 0.530
vm1_simplereturn* 1.647 3.515
vm1_swap* 0.399 0.997
vm1_yield* 1.675 4.162
vm2_array* 1.692 2.751
vm2_bigarray* 28.032 14.551
vm2_bighash* 9.813 14.773
vm2_case* 0.221 0.505
vm2_defined_method* 5.216 9.901
vm2_dstr* 2.265 6.053
vm2_eval* 43.876 251.476
vm2_method* 2.553 5.170
vm2_method_missing* 3.871 9.723
vm2_method_with_block* 2.943 5.717
vm2_mutex* 1.797 3.376
vm2_poly_method* 4.213 10.465
vm2_poly_method_ov* 0.324 0.554
vm2_proc* 0.841 1.764
vm2_raise1* 13.720 32.739
vm2_raise2* 19.382 44.209
vm2_regexp* 1.829 4.610
vm2_send* 0.574 1.262
vm2_super* 0.863 2.004
vm2_unif1* 0.322 0.731
vm2_zsuper* 0.912 2.049
vm3_backtrace 0.473 0.656
vm3_clearmethodcache 1.084 1.647
vm3_gc 16.075 10.622
vm_thread_alive_check1 0.406 0.455
vm_thread_create_join 4.611 5.386
vm_thread_mutex1 1.536 2.835
vm_thread_mutex2 2.712 4.948
vm_thread_mutex3 171.055 207.535
vm_thread_pass 1.281 1.677
vm_thread_pass_flood 0.674 0.297
vm_thread_pipe 0.798 1.401
Speedup ratio: compare with the result of `normal_ruby' (greater is better)
name ctruby
app_answer 0.908
app_aobench 0.510
app_erb 0.493
app_factorial 0.408
app_fib 0.585
app_mandelbrot 0.380
app_pentomino 0.464
app_raise 0.509
app_strconcat 0.367
app_tak 0.561
app_tarai 0.551
app_uri 0.542
hash_shift 38.782
io_file_create 0.867
io_file_read 0.792
io_file_write 0.766
io_select 0.744
io_select2 0.861
io_select3 1.042
loop_for 0.456
loop_generator 0.534
loop_times 0.453
loop_whileloop 0.540
loop_whileloop2 0.674
so_ackermann 0.578
so_array 0.442
so_binary_trees 0.490
so_concatenate 0.465
so_count_words 0.610
so_exception 0.503
so_fannkuch 0.563
so_fasta 0.462
so_k_nucleotide 0.432
so_lists 0.461
so_mandelbrot 0.511
so_matrix 0.446
so_meteor_contest 0.415
so_nbody 0.536
so_nested_loop 0.430
so_nsieve 0.427
so_nsieve_bits 0.395
so_object 0.453
so_partial_sums 0.563
so_pidigits 0.444
so_random 0.506
so_reverse_complement 0.508
so_sieve 0.468
so_spectralnorm 0.457
vm1_attr_ivar* 0.553
vm1_attr_ivar_set* 0.540
vm1_block* 0.447
vm1_const* 0.418
vm1_ensure* 0.563
vm1_float_simple* 0.455
vm1_ivar* 0.687
vm1_ivar_set* 0.706
vm1_length* 0.440
vm1_lvar_init* 0.185
vm1_lvar_set* 0.495
vm1_neq* 0.365
vm1_not* 0.324
vm1_rescue* 0.374
vm1_simplereturn* 0.468
vm1_swap* 0.400
vm1_yield* 0.403
vm2_array* 0.615
vm2_bigarray* 1.926
vm2_bighash* 0.664
vm2_case* 0.437
vm2_defined_method* 0.527
vm2_dstr* 0.374
vm2_eval* 0.174
vm2_method* 0.494
vm2_method_missing* 0.398
vm2_method_with_block* 0.515
vm2_mutex* 0.532
vm2_poly_method* 0.403
vm2_poly_method_ov* 0.584
vm2_proc* 0.477
vm2_raise1* 0.419
vm2_raise2* 0.438
vm2_regexp* 0.397
vm2_send* 0.455
vm2_super* 0.430
vm2_unif1* 0.441
vm2_zsuper* 0.445
vm3_backtrace 0.720
vm3_clearmethodcache 0.658
vm3_gc 1.513
vm_thread_alive_check1 0.894
vm_thread_create_join 0.856
vm_thread_mutex1 0.542
vm_thread_mutex2 0.548
vm_thread_mutex3 0.824
vm_thread_pass 0.764
vm_thread_pass_flood 2.267
vm_thread_pipe 0.569
Log file: bmlog-20131029-020754.98319
@edward

edward commented Oct 29, 2013

Copy link
Copy Markdown
Author

I’m going to try running with CFLAGS=-g3 ./configure --enable-debug-env just to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment