summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-30Improve performance of Range#{min,max}watson1978
range.c (range_min): use OPTIMIZED_CMP() to compare the objects instead of `<=>' method dispatching for Fixnum/Float/String object inside Range object. range.c (range_max): ditto. Range#min -> 34 % up Range#max -> 44 % up [ruby-core:80713] [Bug #13443] [Fix GH-1585] ### Before Range#min 8.428M (± 1.3%) i/s - 42.141M in 5.000952s Range#max 8.157M (± 1.3%) i/s - 40.852M in 5.009297s ### After Range#min 11.269M (± 1.2%) i/s - 56.388M in 5.004611s Range#max 11.764M (± 1.3%) i/s - 58.856M in 5.003820s ### Test code require 'benchmark/ips' Benchmark.ips do |x| x.report "Range#min" do |i| i.times { (1..100).min } end x.report "Range#max" do |i| i.times { (1..100).max } end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29Clean up a bit the Process.setpriority specseregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29Enable Process.setpriority for a single process on more platforms.eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29* 2017-05-30svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29Run in separate process/pgrp [Bug #13609]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29Simplify, avoid extra exceptions and add test for concurrent mspec mkdir_peregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29rubyspec: Fix method redefinition warningk0kubun
ruby/spec/rubyspec/library/erb/run_spec.rb:63: warning: method redefined; discarding old main ruby/spec/rubyspec/library/erb/result_spec.rb:53: warning: previous definition of main was here ruby/spec/rubyspec/library/erb/run_spec.rb:76: warning: method redefined; discarding old main1 ruby/spec/rubyspec/library/erb/result_spec.rb:67: warning: previous definition of main1 was here ruby/spec/rubyspec/library/erb/run_spec.rb:81: warning: method redefined; discarding old main2 ruby/spec/rubyspec/library/erb/result_spec.rb:72: warning: previous definition of main2 was here git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29test/erb/test_erb.rb: Fix unused variable warningk0kubun
ruby/test/erb/test_erb.rb:575: warning: assigned but unused variable - foo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29revert r58954 temporarilyduerst
Revert change to maximum of 4 bytes for UTF-8 characters at r58954 temporarily. This failed spec at https://travis-ci.org/ruby/ruby/builds/237086017, but it is totally unclear why. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29Change max byte length of UTF-8 to 4 bytesduerst
In enc/utf_8.c, change maximum byte length of UTF-8 to 4 bytes (from 6) to conform to definition of UTF-8. This closes issue #13590. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29fix up r58952nobu
* spec/mspec/lib/mspec/helpers/fs.rb (Object#mkdir_p): rescue File.stat when the target does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29fix race conditionnobu
* spec/mspec/lib/mspec/helpers/fs.rb (Object#mkdir_p): fix race condition when multi_exec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29tool/runruby.rb: exec ruby-runnernobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29ruby-runner.c: replace argv[0]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29default.mspec: remove useless flagsnobu
* spec/default.mspec: removed -I options for useless or non- existent paths from flags. there is no library scripts and .ext directory in the source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28suppress warning: ambiguous first argument; put parentheses or a space even ↵naruse
after `-' operator Introduced at r58905 http://rubyci.s3.amazonaws.com/ubuntu/ruby-trunk/log/20170526T153003Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28Revert "Update to ruby/spec@2a047c8"naruse
This reverts commit 2531a1013b56a030f99ea4c2ee36e66dbf38a855. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28* 2017-05-29svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28Revert r58939 and r58942naruse
This reverts following commits because it breaks mswinci * Update to ruby/spec@2a047c8 * Update to ruby/spec@ca32ae2 see also the result: http://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20170528T140014Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28lldb_cruby.py: constants from the targetnobu
* misc/lldb_cruby.py (lldb_init): get constants from ruby_dummy_gdb_enums in the target. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28Update to ruby/spec@ca32ae2eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28Add tool to pull latest mspec/spec when commits have been synchronizederegon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28Update to ruby/spec@2a047c8eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28ruby.c: file in load_file argumentnobu
* ruby.c (load_file): move opened file to an argument, to reduce open/close calls in the near future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28ruby.c: shrink ruby_cmdline_options_tnobu
* ruby.c (ruby_cmdline_options_t): reordered members and turned simple flags into bit fields to reduce the size (136->104 on LP64). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28test/ruby/test_io.rb: adjust CPU usage check to 10%normal
I miscalculated for r58934, since we sleep 100ms, and the worst possible case is 100 Hz in the kernel meaning we only have 10ms resolution. So, we need to increase our CPU percentage to >= 10% for this. This should be more than enough for our CI machines which have 300 Hz kernels [ruby-core:81429]: http://ci.rvm.jp/results/trunk-test@sasada-8core/1495942555 * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): override default percentage git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28process.c: Use getrusage(2) in Process.timesk0kubun
if getrusage(2) is available, to improve precision of Process.times and its user like lib/benchmark.rb. On macOS, since getrusage(2) has better precision than times(3), they are much improved like: * Before Process.times => #<struct Process::Tms utime=0.56, stime=0.35, cutime=0.04, cstime=0.03> puts Benchmark.measure { "a" * 1_000_000_000 } 0.340000 0.310000 0.650000 ( 0.674025) * After Process.times => #<struct Process::Tms utime=0.561899, stime=0.35076, cutime=0.046483, cstime=0.038929> puts Benchmark.measure { "a" * 1_000_000_000 } 0.343223 0.310037 0.653260 ( 0.674025) On Linux, since struct rusage from getrusage(2) is used instead of struct tms from times(2), they are slightly improved like: * Before Process.times => #<struct Process::Tms utime=0.43, stime=0.11, cutime=0.0, cstime=0.0> puts Benchmark.measure { "a" * 1_000_000_000 } 0.120000 0.040000 0.170000 ( 0.171621) * After Process.times => #<struct Process::Tms utime=0.432, stime=0.116, cutime=0.0, cstime=0.0> puts Benchmark.measure { "a" * 1_000_000_000 } 0.124000 0.048000 0.172000 ( 0.171621) [ruby-dev:49471] [Feature #11952] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28tests: increase CPU percentage threshold for assert_cpu_usage_lownormal
When sleeping for the tick rate of 100ms (defined in thread_pthread.c) as we do in test/ruby/test_io.rb (test_copy_stream_no_busy_wait), it may not be possible to measure with <= 10ms resolution on 100HZ systems (CONFIG_HZ in the Linux kernel). So increase the threshold to 15ms (10ms + 5ms slack for slow systems). * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): increase pct default value [ruby-core:81427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Update to ruby/spec@2795010eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Update to ruby/mspec@6c95759eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27* 2017-05-28svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Initial commit of LLDB port of debug utilitynaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27bootstraptest/test_insns.rb: Fix typok0kubun
on test message. "torexp" insn does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27rb_wait_for_single_fd: do not OOM or segfault with invalid FD on select()normal
Instead, match the poll() implementation used on Linux for now; as the Linux poll(2) manpage describes using negative FD to easily ignore an FD in a larger FD set while (sleeping the given timeout). I'm not entirely sure if matching poll() behavior is a good idea for a single FD, but it's better than segfaulting or NoMemoryError. * thread.c (init_set_fd): ignore negative FD * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb (test_wait_for_invalid_fd): check values which may trigger segfaults or OOM git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27test for IO.copy_stream CPU usage (r58534)normal
I'm likely to make similar mistakes in the future when working on Fiber auto-scheduling. Start adding assertions for existing code, first. * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): added * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): added git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Revert "common: "test-all" depends on "exts" target"normal
This reverts r58919. Apparently skipping exts is intentional since r58759 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Improve performance of some Time & Rational methodswatson1978
rational.c (i_gcd): replace GCD algorithm from Euclidean algorithm to Stein algorithm (https://en.wikipedia.org/wiki/Binary_GCD_algorithm). Some Time methods will call internal quov() function and it calls Rational#quo -> f_muldiv() -> i_gcd() in rational.c And some Rational methods also call i_gcd(). The implementation of Euclidean algorithm spent a long time at modulo operation (ie "x = y % x;"). The Stein algorithm will replace with shift operation which is faster than modulo. Time#subsec -> 36 % up Time#to_r -> 26 % up Rational#+ -> 14 % up Rational#- -> 15 % up Rational#* -> 13 % up [ruby-core:80843] [Bug #13503] [Fix GH-1596] ### Before Time#subsec 2.142M (± 9.8%) i/s - 10.659M in 5.022659s Time#to_r 2.003M (± 9.1%) i/s - 9.959M in 5.012445s Rational#+ 3.843M (± 0.9%) i/s - 19.274M in 5.016254s Rational#- 3.820M (± 1.3%) i/s - 19.149M in 5.014137s Rational#* 5.198M (± 1.4%) i/s - 26.016M in 5.005664s * After Time#subsec 2.902M (± 2.9%) i/s - 14.505M in 5.001815s Time#to_r 2.503M (± 4.8%) i/s - 12.512M in 5.011454s Rational#+ 4.390M (± 1.2%) i/s - 22.001M in 5.012413s Rational#- 4.391M (± 1.2%) i/s - 22.013M in 5.014584s Rational#* 5.872M (± 2.2%) i/s - 29.369M in 5.003666s * Test code require 'benchmark/ips' Benchmark.ips do |x| x.report "Time#subsec" do |t| time = Time.now t.times { time.subsec } end x.report "Time#to_r" do |t| time = Time.now t.times { time.to_r } end x.report "Rational#+" do |t| rat1 = 1/2r rat2 = 1/3r t.times { rat1 + rat2 } end x.report "Rational#-" do |t| rat1 = 1/3r rat2 = 1/2r t.times { rat1 - rat2 } end x.report "Rational#*" do |t| rat1 = 1/3r rat2 = 1/2r t.times { rat1 * rat2 } end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27Improve performance of some Time methodswatson1978
internal.h : add rb_numeric_quo() as internal API. rational.c : rename numeric_quo() to rb_numeric_quo() as internal API. time.c (quov): optimize by invoking rb_numeric_quo() to retrieve a value of Numeric#quo instead of method dispatching via rb_funcall(). Time#subsec -> 7 % up Time#- -> 26 % up Time#to_f -> 30 % up Time#to_r -> 7 % up [ruby-core:80915] [Bug #13519] [Fix GH-1601] ### Before Time#subsec 2.024M (± 8.7%) i/s - 10.062M in 5.009762s Time#- 5.049M (± 4.7%) i/s - 25.186M in 5.002379s Time#to_f 5.625M (± 4.2%) i/s - 28.066M in 5.000749s Time#to_r 1.880M (± 9.7%) i/s - 9.361M in 5.027527s ### After Time#subsec 2.155M (± 9.7%) i/s - 10.724M in 5.022579s Time#- 6.362M (± 2.0%) i/s - 31.824M in 5.004625s Time#to_f 7.287M (± 4.8%) i/s - 36.402M in 5.010983s Time#to_r 2.020M (± 9.4%) i/s - 10.059M in 5.021852s ### Test code require 'benchmark/ips' Benchmark.ips do |x| x.report "Time#subsec" do |t| time = Time.now t.times { time.subsec } end x.report "Time#-" do |t| time1 = Time.now time2 = Time.now t.times { time1 - time2 } end x.report "Time#to_f" do |t| time = Time.now t.times { time.to_f } end x.report "Time#to_r" do |t| time = Time.now t.times { time.to_r } end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27.travis.yml: exts is not needed for tests herenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27common: "test-all" depends on "exts" targetnormal
This allows me to test changes to ext/ more easily by only typing: make test-all TESTS=/path/to/ext/test_foo.rb I spent a few minutes wondering what was wrong before I realized changes to exts were not taking effect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27mspec/commands/mspec.rb: formatter for multi_execnobu
* spec/mspec/lib/mspec/commands/mspec.rb (MSpecMain#multi_exec): as multi_exec children must run with yaml formatter, append the option for it after other options to override another formatter option with a warning if it is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27.travis.yml: get number of processors at runtimenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27erb.rb: Use str_uplus instead of rb_str_dupk0kubun
to skip unnecessary string allocation on frozen_string_literal: false. str_uplus can bypass calling rb_str_dup when OBJ_FROZEN is true. * Before erb_render 1.064 * Afete erb_render 0.909 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27benchmark: Rename to bm_erb_render.rbk0kubun
from bm_app_erb_render.rb. I'm told from ko1 that bm_app_* is namespace for Ruby applications, not for ERB and we should use bm_erb_* for ERB benchmark instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e