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.
(This is a retry of r58954, after issue #13590 has been addressed.)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
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
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
* 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
* 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
* 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
* 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
* 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
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
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
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
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
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
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
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
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
* 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