ruby/benchmark
normal 1e14126b4f Dir.empty? releases GVL
This converts all slow syscalls in the Dir.empty? implementation
to release GVL.  We avoid unnecessarily GVL release and
reacquire for each slow call (opendir, readdir, closedir) and
instead only release and acquire the GVL once in the common
case.

Benchmark results show a small degradation in single-threaded
performance:
Execution time (sec)
name	trunk	built
dir_empty_p	0.689	0.758

Speedup ratio: compare with the result of `trunk' (greater is better)
name	built
dir_empty_p	0.909

* dir.c (rb_gc_for_fd_with_gvl): new function
  (nogvl_dir_empty_p): ditto
  (dir_s_empty_p): use new functions to release GVL
* benchmark/bm_dir_empty_p.rb: new benchmark
  [ruby-core:83071] [Feature #13958]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-04 00:04:51 +00:00
..
gc * benchmark/gc/gcbench.rb: check GC::OPTS availability 2013-12-19 01:49:59 +00:00
other-lang
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: fix typos. 2015-12-14 02:50:01 +00:00
bm_app_erb.rb
bm_app_factorial.rb
bm_app_fib.rb
bm_app_lc_fizzbuzz.rb * benchmark/bm_app_lc_fizzbuzz.rb: should skip output on benchmark. 2014-09-08 07:08:56 +00:00
bm_app_mandelbrot.rb
bm_app_pentomino.rb
bm_app_raise.rb
bm_app_strconcat.rb
bm_app_tak.rb
bm_app_tarai.rb
bm_app_uri.rb
bm_array_sample_100k_10.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k_11.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k__1k.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k__6k.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k__100.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k___10k.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_sample_100k___50k.rb benchmarks for Bug#13136 2017-01-20 02:27:28 +00:00
bm_array_shift.rb * array.c: Improve performance of Array#shift. use shared instead of 2015-01-03 02:27:50 +00:00
bm_array_small_and.rb array.c: improve operations on small arrays 2017-09-29 07:43:22 +00:00
bm_array_small_diff.rb array.c: improve operations on small arrays 2017-09-29 07:43:22 +00:00
bm_array_small_or.rb array.c: improve operations on small arrays 2017-09-29 07:43:22 +00:00
bm_array_sort_block.rb array.c: improve performance of Array#sort with block 2017-04-13 09:25:38 +00:00
bm_array_sort_float.rb Add a benchmark script for Array#sort of float array 2017-04-13 08:09:06 +00:00
bm_bighash.rb * benchmark/: add vnmakarov's benchmarks around hash [ruby-core:75265] 2016-09-14 16:00:55 +00:00
bm_dir_empty_p.rb Dir.empty? releases GVL 2017-10-04 00:04:51 +00:00
bm_erb_render.rb benchmark: Rename to bm_erb_render.rb 2017-05-27 02:47:11 +00:00
bm_file_rename.rb File#rename releases GVL 2017-10-01 21:19:24 +00:00
bm_hash_aref_dsym.rb new benchmarks for hashing dsyms and fixnums 2015-07-29 19:54:12 +00:00
bm_hash_aref_dsym_long.rb new benchmarks for hashing dsyms and fixnums 2015-07-29 19:54:12 +00:00
bm_hash_aref_fix.rb new benchmarks for hashing dsyms and fixnums 2015-07-29 19:54:12 +00:00
bm_hash_aref_flo.rb bm_hash_aref_flo.rb: fix data 2015-03-25 02:20:43 +00:00
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 benchmark/bm_hash_aref_sym*.rb: force static symbols 2014-10-09 03:44:12 +00:00
bm_hash_aref_sym_long.rb benchmark/bm_hash_aref_sym*.rb: force static symbols 2014-10-09 03:44:12 +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_flo.rb fix flonum hashing regression from r45384 2015-01-22 07:48:59 +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_long.rb * benchmark/: add vnmakarov's benchmarks around hash [ruby-core:75265] 2016-09-14 16:00:55 +00:00
bm_hash_shift.rb
bm_hash_shift_u16.rb hash.c (rb_num_hash_start): avoid pathological behavior 2015-12-11 08:23:46 +00:00
bm_hash_shift_u24.rb hash.c (rb_num_hash_start): avoid pathological behavior 2015-12-11 08:23:46 +00:00
bm_hash_shift_u32.rb hash.c (rb_num_hash_start): avoid pathological behavior 2015-12-11 08:23:46 +00:00
bm_hash_small2.rb * benchmark/: add vnmakarov's benchmarks around hash [ruby-core:75265] 2016-09-14 16:00:55 +00:00
bm_hash_small4.rb * benchmark/: add vnmakarov's benchmarks around hash [ruby-core:75265] 2016-09-14 16:00:55 +00:00
bm_hash_small8.rb * benchmark/: add vnmakarov's benchmarks around hash [ruby-core:75265] 2016-09-14 16:00:55 +00:00
bm_hash_to_proc.rb bm_hash_to_proc.rb 2015-11-10 09:22:37 +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_int_quo.rb Improve performance of type conversion using to_r 2017-04-14 05:19:12 +00:00
bm_io_copy_stream_write.rb add benchmark for IO.copy_stream IO#write case 2016-12-31 00:41:14 +00:00
bm_io_copy_stream_write_socket.rb another benchmark for IO.copy_stream socket writing 2017-01-18 18:23:49 +00:00
bm_io_file_create.rb
bm_io_file_read.rb
bm_io_file_write.rb
bm_io_nonblock_noex.rb delay `exception: false' checks for minor speedup 2015-07-02 22:22:14 +00:00
bm_io_nonblock_noex2.rb io.c: avoid kwarg parsing in C API 2015-11-12 02:00:41 +00:00
bm_io_pipe_rw.rb benchmark: new single-threaded read/write benchmark with pipe 2017-05-04 02:13:11 +00:00
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
bm_loop_whileloop2.rb
bm_marshal_dump_flo.rb benchmark/bm_marshal_dump_flo.rb: new benchmark for [Bug #10761] 2015-01-23 08:13:59 +00:00
bm_marshal_dump_load_geniv.rb variable.c: avoid compatibility table with generic ivars 2015-05-30 00:20:15 +00:00
bm_marshal_dump_load_time.rb variable.c: avoid compatibility table with generic ivars 2015-05-30 00:20:15 +00:00
bm_require.rb * benchmark/bm_require.rb: new benchmark for require. 2015-10-08 21:31:49 +00:00
bm_require_thread.rb * benchmark/bm_require.rb: new benchmark for require. 2015-10-08 21:31:49 +00:00
bm_securerandom.rb * lib/securerandom.rb: use OpenSSL::BN for performance improvement. 2014-08-08 11:00:47 +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
bm_so_count_words.rb
bm_so_exception.rb
bm_so_fannkuch.rb
bm_so_fasta.rb get rid of ambiguous parentheses warnings 2016-11-29 16:06:54 +00:00
bm_so_k_nucleotide.rb
bm_so_lists.rb
bm_so_mandelbrot.rb
bm_so_matrix.rb
bm_so_meteor_contest.rb get rid of ambiguous parentheses warnings 2016-11-29 16:06:54 +00:00
bm_so_nbody.rb
bm_so_nested_loop.rb
bm_so_nsieve.rb
bm_so_nsieve_bits.rb
bm_so_object.rb
bm_so_partial_sums.rb
bm_so_pidigits.rb get rid of ambiguous parentheses warnings 2016-11-29 16:06:54 +00:00
bm_so_random.rb
bm_so_reverse_complement.rb
bm_so_sieve.rb
bm_so_spectralnorm.rb
bm_string_index.rb string.c: avoid unnecessary call of str_strlen() 2017-10-01 13:44:49 +00:00
bm_string_scan_re.rb benchmarks for String#scan 2017-08-04 04:25:12 +00:00
bm_string_scan_str.rb benchmarks for String#scan 2017-08-04 04:25:12 +00:00
bm_time_subsec.rb Improve performance of type conversion using to_r 2017-04-14 05:19:12 +00:00
bm_vm1_attr_ivar.rb
bm_vm1_attr_ivar_set.rb
bm_vm1_block.rb
bm_vm1_const.rb
bm_vm1_ensure.rb
bm_vm1_float_simple.rb
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 benchmark/bm_vm1_gc_wb_*.rb: fix GC.start args for invalid keyword 2017-05-04 08:55:54 +00:00
bm_vm1_gc_wb_ary_promoted.rb benchmark/bm_vm1_gc_wb_*.rb: fix GC.start args for invalid keyword 2017-05-04 08:55:54 +00:00
bm_vm1_gc_wb_obj.rb benchmark/bm_vm1_gc_wb_*.rb: fix GC.start args for invalid keyword 2017-05-04 08:55:54 +00:00
bm_vm1_gc_wb_obj_promoted.rb benchmark/bm_vm1_gc_wb_*.rb: fix GC.start args for invalid keyword 2017-05-04 08:55:54 +00:00
bm_vm1_ivar.rb
bm_vm1_ivar_set.rb
bm_vm1_length.rb
bm_vm1_lvar_init.rb
bm_vm1_lvar_set.rb
bm_vm1_neq.rb
bm_vm1_not.rb
bm_vm1_rescue.rb
bm_vm1_simplereturn.rb
bm_vm1_swap.rb
bm_vm1_yield.rb
bm_vm2_array.rb
bm_vm2_bigarray.rb
bm_vm2_bighash.rb
bm_vm2_case.rb
bm_vm2_case_lit.rb compile optimized case dispatch for nil/true/false 2015-12-08 01:46:45 +00:00
bm_vm2_defined_method.rb
bm_vm2_dstr.rb
bm_vm2_eval.rb
bm_vm2_fiber_switch.rb benchmark/bm_vm2_fiber_switch.rb: check for fiber performance 2017-05-08 01:59:12 +00:00
bm_vm2_method.rb
bm_vm2_method_missing.rb
bm_vm2_method_with_block.rb
bm_vm2_module_ann_const_set.rb benchmarks for [Bug #13113] [ci skip] 2017-01-08 01:46:10 +00:00
bm_vm2_module_const_set.rb benchmarks for [Bug #13113] [ci skip] 2017-01-08 01:46:10 +00:00
bm_vm2_mutex.rb Use qualified names 2016-08-30 06:22:30 +00:00
bm_vm2_newlambda.rb proc.c (rb_proc_alloc): inline and move to vm.c 2014-09-12 20:57:45 +00:00
bm_vm2_poly_method.rb
bm_vm2_poly_method_ov.rb
bm_vm2_poly_singleton.rb Copy the serial number from the super class to the singleton class 2016-09-12 15:40:09 +00:00
bm_vm2_proc.rb
bm_vm2_raise1.rb
bm_vm2_raise2.rb
bm_vm2_regexp.rb
bm_vm2_send.rb
bm_vm2_string_literal.rb string.c: fix non-embedded string 2015-10-07 11:43:17 +00:00
bm_vm2_struct_big_aref_hi.rb struct: avoid all O(n) behavior on access 2014-12-09 15:43:49 +00:00
bm_vm2_struct_big_aref_lo.rb struct: avoid all O(n) behavior on access 2014-12-09 15:43:49 +00:00
bm_vm2_struct_big_aset.rb struct: avoid all O(n) behavior on access 2014-12-09 15:43:49 +00:00
bm_vm2_struct_big_href_hi.rb add benchmarks for struct[:name] 2015-06-22 20:10:07 +00:00
bm_vm2_struct_big_href_lo.rb add benchmarks for struct[:name] 2015-06-22 20:10:07 +00:00
bm_vm2_struct_big_hset.rb add benchmarks for struct[:name] 2015-06-22 20:10:07 +00:00
bm_vm2_struct_small_aref.rb struct: avoid all O(n) behavior on access 2014-12-09 15:43:49 +00:00
bm_vm2_struct_small_aset.rb struct: avoid all O(n) behavior on access 2014-12-09 15:43:49 +00:00
bm_vm2_struct_small_href.rb add benchmarks for struct[:name] 2015-06-22 20:10:07 +00:00
bm_vm2_struct_small_hset.rb add benchmarks for struct[:name] 2015-06-22 20:10:07 +00:00
bm_vm2_super.rb
bm_vm2_unif1.rb
bm_vm2_zsuper.rb
bm_vm3_backtrace.rb
bm_vm3_clearmethodcache.rb
bm_vm3_gc.rb bm_vm3_gc.rb: no shebang 2015-09-29 08:03:12 +00:00
bm_vm3_gc_old_full.rb * benchmark/bm_vm3_gc_old_full.rb: add GC.start benchmark. 2016-03-09 06:05:53 +00:00
bm_vm3_gc_old_immediate.rb * benchmark/bm_vm3_gc_old_full.rb: add GC.start benchmark. 2016-03-09 06:05:53 +00:00
bm_vm3_gc_old_lazy.rb * benchmark/bm_vm3_gc_old_full.rb: add GC.start benchmark. 2016-03-09 06:05:53 +00:00
bm_vm_symbol_block_pass.rb bm_vm_symbol_block_pass.rb: rename 2015-09-29 00:21:10 +00:00
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_condvar1.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
bm_vm_thread_condvar2.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
bm_vm_thread_create_join.rb
bm_vm_thread_mutex1.rb Use qualified names 2016-08-30 06:22:30 +00:00
bm_vm_thread_mutex2.rb Use qualified names 2016-08-30 06:22:30 +00:00
bm_vm_thread_mutex3.rb Use qualified names 2016-08-30 06:22:30 +00:00
bm_vm_thread_pass.rb
bm_vm_thread_pass_flood.rb benchmark/bm_vm_thread_pass_flood.rb: add comment 2017-05-04 16:47:17 +00:00
bm_vm_thread_pipe.rb * benchmark/bm_app_aobench.rb: fix typos. 2015-12-14 02:50:01 +00:00
bm_vm_thread_queue.rb Use qualified names 2016-08-30 06:22:30 +00:00
bm_vm_thread_sized_queue.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
bm_vm_thread_sized_queue2.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
bm_vm_thread_sized_queue3.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
bm_vm_thread_sized_queue4.rb more benchmarks for SizedQueue and ConditionVariable 2017-05-02 02:40:46 +00:00
driver.rb driver.rb: measure_target option [ci skip] 2017-01-08 03:51:35 +00:00
make_fasta_output.rb
memory_wrapper.rb * benchmark/driver.rb: fix output messages. 2016-03-09 07:42:32 +00:00
prepare_require.rb * benchmark/prepare_require.rb: skip file creation if it already 2015-10-08 21:53:48 +00:00
prepare_require_thread.rb * benchmark/bm_require.rb: new benchmark for require. 2015-10-08 21:31:49 +00:00
prepare_so_count_words.rb
prepare_so_k_nucleotide.rb * benchmark/prepare_so_k_nucleotide.rb: use require_relative. 2014-07-11 02:13:09 +00:00
prepare_so_reverse_complement.rb * benchmark/prepare_so_k_nucleotide.rb: use require_relative. 2014-07-11 02:13:09 +00:00
report.rb
run.rb
runc.rb
wc.input.base