1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/benchmark
normal f11db2a605 vm*: doubly-linked list from ccan to manage vm->living_threads
A doubly-linked list for tracking living threads guarantees
constant-time insert/delete performance with no corner cases of a
hash table.  I chose this ccan implementation of doubly-linked
lists over the BSD sys/queue.h implementation since:

1) insertion and removal are both branchless
2) locality is improved if a struct may be a member of multiple lists
   (0002 patch in Feature 9632 will introduce a secondary list
   for waiting FDs)

This also increases cache locality during iteration: improving
performance in a new IO#close benchmark with many sleeping threads
while still scanning the same number of threads.

	vm_thread_close 1.762

* vm_core.h (rb_vm_t): list_head and counter for living_threads
  (rb_thread_t): vmlt_node for living_threads linkage
  (rb_vm_living_threads_init): new function wrapper
  (rb_vm_living_threads_insert): ditto
  (rb_vm_living_threads_remove): ditto
* vm.c (rb_vm_living_threads_foreach): new function wrapper
* thread.c (terminate_i, thread_start_func_2, thread_create_core,
  thread_fd_close_i, thread_fd_close): update to use new APIs
* vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
  vm_memsize, vm_init2, Init_VM): ditto
* vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
* benchmark/bm_vm_thread_close.rb: added to show improvement
* ccan/build_assert/build_assert.h: added as a dependency of list.h
* ccan/check_type/check_type.h: ditto
* ccan/container_of/container_of.h: ditto
* ccan/licenses/BSD-MIT: ditto
* ccan/licenses/CC0: ditto
* ccan/str/str.h: ditto (stripped of unused macros)
* ccan/list/list.h: ditto
* common.mk: add CCAN_LIST_INCLUDES
  [ruby-core:61871][Feature 9632 (part 1)]

Apologies for the size of this commit, but I think a good
doubly-linked list will be useful for future features, too.
This may be used to add ordering to a container_of-based hash
table to preserve compatibility if required (e.g. feature 9614).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 23:48:51 +00:00
..
gc * benchmark/gc/gcbench.rb: check GC::OPTS availability 2013-12-19 01:49:59 +00:00
other-lang * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_app_answer.rb * benchmark/bm_app_answer.rb: revert r42990, benchmark scripts should 2013-09-22 10:01:22 +00:00
bm_app_aobench.rb * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of 2013-06-20 07:58:13 +00:00
bm_app_erb.rb
bm_app_factorial.rb
bm_app_fib.rb
bm_app_mandelbrot.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_app_pentomino.rb
bm_app_raise.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_app_strconcat.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_app_tak.rb
bm_app_tarai.rb
bm_app_uri.rb
bm_hash_aref_miss.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_aref_str.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_aref_sym.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_aref_sym_long.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_flatten.rb * benchmark/bm_hash_flatten.rb: added. r43896 is about 4 times faster 2013-11-28 10:50:41 +00:00
bm_hash_ident_num.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_ident_obj.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_ident_str.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_ident_sym.rb st.c: use power-of-two sizes to avoid slow modulo ops 2014-03-22 23:34:21 +00:00
bm_hash_keys.rb * benchmark/bm_hash_flatten.rb: added. r43896 is about 4 times faster 2013-11-28 10:50:41 +00:00
bm_hash_shift.rb * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift 2013-04-25 05:03:30 +00:00
bm_hash_values.rb * benchmark/bm_hash_flatten.rb: added. r43896 is about 4 times faster 2013-11-28 10:50:41 +00:00
bm_io_file_create.rb
bm_io_file_read.rb
bm_io_file_write.rb
bm_io_select.rb
bm_io_select2.rb
bm_io_select3.rb
bm_loop_for.rb
bm_loop_generator.rb
bm_loop_times.rb
bm_loop_whileloop.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_loop_whileloop2.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_ackermann.rb
bm_so_array.rb
bm_so_binary_trees.rb * benchmark/bm_so_binary_trees.rb: disable `puts' method 2013-06-20 07:30:41 +00:00
bm_so_concatenate.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_count_words.rb
bm_so_exception.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_fannkuch.rb
bm_so_fasta.rb
bm_so_k_nucleotide.rb
bm_so_lists.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_mandelbrot.rb
bm_so_matrix.rb
bm_so_meteor_contest.rb * benchmark/bm_so_meteor_contest.rb: [DOC] Fix a few typos 2013-12-28 08:25:28 +00:00
bm_so_nbody.rb
bm_so_nested_loop.rb
bm_so_nsieve.rb
bm_so_nsieve_bits.rb * benchmark/bm_so_nsieve_bits.rb: add an encoding pragma. 2012-11-21 07:15:03 +00:00
bm_so_object.rb
bm_so_partial_sums.rb
bm_so_pidigits.rb
bm_so_random.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_reverse_complement.rb
bm_so_sieve.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_so_spectralnorm.rb
bm_vm1_attr_ivar.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_attr_ivar_set.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_block.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_const.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_ensure.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_float_simple.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_gc_short_lived.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_gc_short_with_complex_long.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_gc_short_with_long.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_gc_short_with_symbol.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_gc_wb_ary.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_gc_wb_obj.rb * properties. 2013-11-06 00:21:05 +00:00
bm_vm1_ivar.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_ivar_set.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_length.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_lvar_init.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_lvar_set.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_neq.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_not.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_rescue.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_simplereturn.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_swap.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm1_yield.rb * benchmark/bm_vm1_yield.rb: add a benchmark to measure `yield' 2012-10-16 20:37:25 +00:00
bm_vm2_array.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_bigarray.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_bighash.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_case.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_defined_method.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_dstr.rb * benchmark/bm_vm2_dstr.rb: add a benchmark to measure 2012-10-16 23:47:51 +00:00
bm_vm2_eval.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_method.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_method_missing.rb * benchmark/bm_vm2_method_missing.rb: add a benchmark to measure 2012-10-17 07:26:58 +00:00
bm_vm2_method_with_block.rb * benchmark/bm_vm1_yield.rb: add a benchmark to measure `yield' 2012-10-16 20:37:25 +00:00
bm_vm2_mutex.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_poly_method.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_poly_method_ov.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_proc.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_raise1.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_raise2.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_regexp.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_send.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_super.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_unif1.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm2_zsuper.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm3_backtrace.rb
bm_vm3_clearmethodcache.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm3_gc.rb
bm_vm_thread_alive_check1.rb
bm_vm_thread_close.rb vm*: doubly-linked list from ccan to manage vm->living_threads 2014-05-10 23:48:51 +00:00
bm_vm_thread_create_join.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm_thread_mutex1.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm_thread_mutex2.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm_thread_mutex3.rb * benchmark/: add missing spaces around assignment operators (= and +=) for 2012-10-15 12:53:12 +00:00
bm_vm_thread_pass.rb
bm_vm_thread_pass_flood.rb * benchmark/bm_vm1_lvar_init.rb: added. 2012-05-27 14:41:01 +00:00
bm_vm_thread_pipe.rb
bm_vm_thread_queue.rb * properties. 2013-11-06 00:21:05 +00:00
driver.rb * benchmark/driver.rb: remove debug output and output results into 2014-05-07 03:07:10 +00:00
make_fasta_output.rb
prepare_so_count_words.rb
prepare_so_k_nucleotide.rb
prepare_so_reverse_complement.rb
report.rb
run.rb
runc.rb
wc.input.base