(https://github.com/ruby/irb/pull/835)
* Remove unnecessary code from the exit command's implementation
1. The parameters of `IRB.irb_exit` were never used. But there are some
libraries seem to call it with arguments + it's declared on the top-level
IRB constant. So I changed the params to anonymous splat instead of removing them.
2. `Context#exit` was completely unnecessary as `IRB.irb_exit` doesn't use
the `@irb` instance it passes. And since it's (or should be treated as)
a private method, I simply removed it.
3. The `exit` command doesn't use the status argument it receives at all.
But to avoid raising errors on usages like `exit 1`, I changed the argument to
anonymous splat instead removing it.
* Make exit an actual command
* Update readme
https://github.com/ruby/irb/commit/452b543a65
RDoc options that do not change and can be written in `.rdoc_options`
file are moved, so that they match when called without `make`.
Get rid of parsing the files in `page_dir` twice (as relative paths
and absolute paths).
`@locale` is set from `@locale_name` and loaded from `@locale_dir`
after `write_options`, and `RDoc::I18n::Locale` does not seem to
expected to be loaded.
https://github.com/ruby/rdoc/commit/fd610f7023
Otherwise, the path could be considered part of the host or port.
This is better than modifying the path to make it absolute when
a host or port is set. We could also raise for invalid paths
when a host or port is set using check_path, but that results
in weird errors, and won't catch issues (such as ftp allowing a
relative path).
Fixes [Bug #19916]
https://github.com/ruby/uri/commit/ac32aa005b
Before this patch, the MN scheduler waits for the IO with the
following steps:
1. `poll(fd, timeout=0)` to check fd is ready or not.
2. if fd is not ready, waits with MN thread scheduler
3. call `func` to issue the blocking I/O call
The advantage of advanced `poll()` is we can wait for the
IO ready for any fds. However `poll()` becomes overhead
for already ready fds.
This patch changes the steps like:
1. call `func` to issue the blocking I/O call
2. if the `func` returns `EWOULDBLOCK` the fd is `O_NONBLOCK`
and we need to wait for fd is ready so that waits with MN
thread scheduler.
In this case, we can wait only for `O_NONBLOCK` fds. Otherwise
it waits with blocking operations such as `read()` system call.
However we don't need to call `poll()` to check fd is ready
in advance.
With this patch we can observe performance improvement
on microbenchmark which repeats blocking I/O (not
`O_NONBLOCK` fd) with and without MN thread scheduler.
```ruby
require 'benchmark'
f = open('/dev/null', 'w')
f.sync = true
TN = 1
N = 1_000_000 / TN
Benchmark.bm{|x|
x.report{
TN.times.map{
Thread.new{
N.times{f.print '.'}
}
}.each(&:join)
}
}
__END__
TN = 1
user system total real
ruby32 0.393966 0.101122 0.495088 ( 0.495235)
ruby33 0.493963 0.089521 0.583484 ( 0.584091)
ruby33+MN 0.639333 0.200843 0.840176 ( 0.840291) <- Slow
this+MN 0.512231 0.099091 0.611322 ( 0.611074) <- Good
```
[Bug #20145]
Before this commit, both copy_compare_by_id and hash_copy will create a
copy of the ST table, so the ST table created in copy_compare_by_id will
be leaked.
h = { 1 => 2 }.compare_by_identity
10.times do
1_000_000.times do
h.select { false }
end
puts `ps -o rss= -p #{$$}`
end
Before:
110736
204352
300272
395520
460704
476736
542000
604704
682624
770528
After:
15504
16048
16144
16256
16320
16320
16752
16752
16752
16752
Because bundled gems cannot be loaded at test-all, this test which
depends on one of the bundled gems, `rake`, always does nothing except
print an expected warning.
There is a memory leak in Encoding.default_external= and
Encoding.default_internal= because the duplicated name is not freed
when overwriting.
10.times do
1_000_000.times do
Encoding.default_internal = nil
end
puts `ps -o rss= -p #{$$}`
end
Before:
25664
41504
57360
73232
89168
105056
120944
136816
152720
168576
After:
9648
9648
9648
9680
9680
9680
9680
9680
9680
9680