summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-24dir.c: prefer NAMLEN to d_namenobu
* dir.c (glob_helper): prefer NAMLEN, do not assume d_name is NUL terminated everywhere. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24test_http.rb: fix r58855nobu
* test/net/http/test_http.rb (test_s_start): git rid of error when failed to start a connection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24enum.c: respect method visibilitynobu
* enum.c (ary_inject_op): should respect method visibility, do not optimize uncallable method. [ruby-core:81349] [Bug #13592] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24test_enum.rb: test_inject_array_op_redefinednobu
* test/ruby/test_enum.rb (test_inject_array_op_redefined): test other operators too. [Bug#12178] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24assertions.rb: AllFailures#foreachnobu
* test/lib/test/unit/assertions.rb (AllFailures#foreach): shortcircuit for `each` and `AllFailures#for`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24duplicate methodnobu
* test/ruby/test_enum.rb (assert_float_equal): remove overridden definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24Improve performance in where push the element into non shared Array objectwatson1978
* array.c (ary_ensure_room_for_push): use rb_ary_modify_check() instead of rb_ary_modify() to check whether the object can be modified for non shared Array object. rb_ary_modify() has the codes for shared Array object too. In here, it has condition branch for shared / non shared Array object and it can use rb_ary_modify_check() which is smaller function than rb_ary_modify() for non shared object. rb_ary_modify_check() will be expand as inline function. If it will compile with GCC, Array#<< will be faster around 8%. [ruby-core:81082] [Bug #13553] [Fix GH-1609] ## Clang 802.0.42 ### Before Array#<< 9.353M (± 1.7%) i/s - 46.787M in 5.004123s Array#push 7.702M (± 1.1%) i/s - 38.577M in 5.009338s Array#values_at 6.133M (± 1.9%) i/s - 30.699M in 5.007772s ### After Array#<< 9.458M (± 2.0%) i/s - 47.357M in 5.009069s Array#push 7.921M (± 1.8%) i/s - 39.665M in 5.009151s Array#values_at 6.377M (± 2.3%) i/s - 31.881M in 5.001888s ### Result Array#<< -> 1.2% faster Array#push -> 2.8% faster Array#values_at -> 3.9% faster ## GCC 7.1.0 ### Before Array#<< 10.497M (± 1.1%) i/s - 52.665M in 5.017601s Array#push 8.527M (± 1.6%) i/s - 42.777M in 5.018003s Array#values_at 7.621M (± 1.7%) i/s - 38.152M in 5.007910s ### After Array#<< 11.403M (± 1.3%) i/s - 57.028M in 5.001849s Array#push 8.924M (± 1.3%) i/s - 44.609M in 4.999940s Array#values_at 8.291M (± 1.4%) i/s - 41.487M in 5.004727s ### Result Array#<< -> 8.3% faster Array#push -> 4.3% faster Array#values_at -> 8.7% faster ## Test code require 'benchmark/ips' Benchmark.ips do |x| x.report "Array#<<" do |i| i.times { [1,2] << 3 } end x.report "Array#push" do |i| i.times { [1,2].push(3) } end x.report "Array#values_at" do |i| ary = [1, 2, 3, 4, 5] i.times { ary.values_at(0, 2, 4) } end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24string.c: for small crypt_datanobu
* string.c (rb_str_crypt): struct crypt_data defined in missing/crypt.h is small enough. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24Add debug counters.ko1
* debug_counter.h: add the following counters to measure object types. obj_free: freed count obj_str_ptr: freed count of Strings they have extra buff. obj_str_embed: freed count of Strings they don't have extra buff. obj_str_shared: freed count of Strings they have shared extra buff. obj_str_nofree: freed count of Strings they are marked as nofree. obj_str_fstr: freed count of Strings they are marked as fstr. obj_ary_ptr: freed count of Arrays they have extra buff. obj_ary_embed: freed count of Arrays they don't have extra buff. obj_obj_ptr: freed count of Objects (T_OBJECT) they have extra buff. obj_obj_embed: freed count of Objects they don't have extra buff. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24string.c (rb_str_crypt): fix excessive stack use with crypt_rnormal
"struct crypt_data" is 131232 bytes on x86-64 GNU/Linux, making it unsafe to use tiny Fiber stack sizes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24rubyspec/core/io/popen_spec: avoid lingering "ruby -e sleep" processnormal
The ruby_cmd helper blindly escapes code blocks passed to it, causing "sleep" to be quoted in the command-line. This quoting results in IO.popen using a subshell (/bin/sh) to run the given string command instead of invoking the Ruby executable directly. Thus, IO.popen would only see the PID of the subshell via IO#pid, and merely sending SIGKILL to the subshell would not result in the child ("ruby -e sleep") being killed. This problem with lingering ruby processes was easier to reproduce on slow or heavily-loaded systems using low-scheduling priority (e.g. "chrt -i 0 make test-rubyspec") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23* 2017-05-24svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23skip on Solaris 11naruse
On Solaris 11, MSG_OOB is in readfds? http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-trunk/log/20170523T152403Z.fail.html.gz http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20170523T152503Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23Dir as base optionnobu
* dir.c (glob_helper): support Dir instance as `base` option. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23test_dir.rb: sortnobu
* test/ruby/test_dir.rb (test_glob_base): sort the globbed result to compare. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23Dir.glob base optionnobu
* dir.c (dir_s_aref, dir_s_glob): add new optional keyword argument, `base`. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23readonly srcdirnobu
.travis.yml: make srcdir unwritable during build and tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23out-of-place on travisnobu
* .travis.yml (before_script, script): out-of-place build. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23fix FD leaksnobu
* test/net/http/test_http.rb (test_s_start): finish connections to get rid of FD leaks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23LABEL_FORMATnobu
* compile.c (LABEL_FORMAT): extract format string for labels. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23unused membernobu
* vsnprintf.c (__sFILE): _lbfsize is not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23Use test-unit 3.2.4kou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23readonly srcdirnobu
appveyor.yml: make srcdir unwritable during build and tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23appveyor.yml: remove unused UNICODE_DATA_DIRnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22* 2017-05-23svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22variable.c (autoload_sleep_done): avoid needless list_node initnormal
We do not need list_del_init in ensure callbacks, only list_del, since it can only ever be called after list_del_init in autoload_reset. So avoid the needless re-initialization. * variable.c (autoload_sleep_done): s/list_del_init/list_del/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22source directory may not be writablenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22lib/net/protocol.rb: account read_bytes before caller sees itnormal
Users may modify the chunk yielded to them in Net::HTTPResponse#read_body. This will allow users to reduce memory usage by calling String#clear on the buffer once they're done using it. * lib/net/protocol.rb (read): increment read_bytes earlier (read_all): ditto * test/net/http/test_httpresponse.rb (test_read_body_block_mod): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22hash.c: [DOC] fix docs for Hash#transform_values!rhe
Hash#transform_values! returns the receiver rather than a new Hash object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22net/imap: separate @continuation_request_exception from @exceptionshugo
Otherwise literal data will be sent even if NO response is returned because @exception is set to nil in receive_responses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22downloader.rb: true symlink on cygwinnobu
* tool/downloader.rb (Downloader.link_cache): on Cygwin, make true symlink only, which is provided by the OS. as mingw/mswin ruby can't follow cygwin's pseudo symlink, it will fail on the same source tree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22erb.rb: Skip creating regexpk0kubun
if stags and etags are not changed from default. :putobject insn (of regexp) will be used instead of :toregexp insn. This means that the regexp won't be compiled for every `SimpleScanner#scan` call. It may not be a good idea to apply this kind of optimization for all cases. But I applied this because it is default scanner and used frequently and has relatively large impact for benchmark like this: * Before app_erb 1.023 * After app_erb 0.781 This commit fixes only the bottleneck of performance regression introduced in r53412. For maintainability, I won't fix other small regressions like additional overhead of method calls. [ruby-core:73820] [Bug #12074] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22fix r58833nobu
* tool/downloader.rb (Downloader.download): just link to the cache when downloaded to the cache but not the target file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21lib/net/protocol: clear short-lived read buffernormal
Using a parallel Net::HTTP downloader, this reduced memory usage from around 120MB to 50MB on my 32-bit x86 system. * lib/net/protocol.rb (rbuf_fill): clear temporary buffer Test script I used: require 'net/http' require 'uri' require 'digest/sha1' url = 'http://80x24.org/git-i-forgot-to-pack/objects/pack/pack-97b25a76c03b489d4cbbd85b12d0e1ad28717e55.idx' uri = URI(url) use_ssl = "https" == uri.scheme thrs = 30.times.map do Thread.start do cur = Thread.current.object_id Net::HTTP.start(uri.host, uri.port, use_ssl: use_ssl) do |http| req = Net::HTTP::Get.new(uri) http.request(req) do |res| dig = Digest::SHA1.new res.read_body do |buf| dig.update(buf) #buf.clear # most Ruby programmers don't do this :< end warn "#{Time.now} #{cur} #{dig.hexdigest}\n" end end :done end end p thrs.map(&:value) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21String#casecmp no longer raises TypeErrorstomar
* See https://bugs.ruby-lang.org/issues/13312 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21NEWS: String#{casecmp,casecmp?} [Bug #13312]stomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21string.c: fix String#{casecmp,casecmp?} for non-string argumentsstomar
* string.c: make String#{casecmp,casecmp?} return nil for non-string arguments instead of raising a TypeError. * test/ruby/test_string.rb: add tests. Reported by Marcus Stollsteimer. Based on a patch by Shingo Morita. [ruby-core:80145] [Bug #13312] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21test_string.rb,test_symbol.rb: add some testsstomar
* test/ruby/test_string.rb: add more test cases for String#casecmp. * test/ruby/test_symbol.rb: ditto for Symbol#{casecmp,casecmp?}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21Use should_receive expectation instead of singleton methodstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21* 2017-05-22svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21downloader cachenobu
* tool/downloader.rb (Downloader.download): manage download cache. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21remove verify optionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21downloader.rb: utilize dir argumentnobu
* tool/downloader.rb (Downloader::RubyGems.download): utilize `dir` argument of Downloader.download. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21Add missing word in transform_values methods descriptionkazu
Explicitly says that the methods return a new hash rather than just stating it return a new something we don't know. [ci skip] [Fix GH-1619] Author: Nicolas Cavigneaux <nico@bounga.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21Improve Time#+ & Time#- performancewatson1978
* time.c (wadd): use internal addv() function to calculate internal value in Time object. On 64-bit machine, Time object might have Fixnum object internally by default and addv() can calculate Fixnum objects directly. * time.c (wsub): use internal subv() function due the same reason in above. Time#+ & Time#- will be faster around 15%. [ruby-dev:50036] [Bug #13357] [Fix GH-1547] ### Before user system total real Time#+ 0.820000 0.000000 0.820000 ( 0.818081) Time#- 0.810000 0.000000 0.810000 ( 0.813835) ### After user system total real Time#+ 0.710000 0.000000 0.710000 ( 0.710241) Time#- 0.710000 0.010000 0.720000 ( 0.714151) ### Test code require 'benchmark' Benchmark.bmbm do |x| x.report "Time#+" do t = Time.now 2000000.times do t + 1 end end x.report "Time#-" do t = Time.now 2000000.times do t - 1 end end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21Improve Time#<=> performancewatson1978
* time.c (wcmp): use internal cmp() function for comparing internal Fixnum value in Time objects. On 64-bit machine, Time object might have Fixnum object internally by default and cmp() can compare the Fixnum objects directly. Time#<=> will be faster around 60% on 64-bit machine. * time.c (cmp): add optimized path for comparing internal Bignum value by using rb_big_cmp() API. On 32-bit machine, Time object might have Bignum object internally by default. Time#<=> will be faster around 50% on 32-bit machine. [ruby-dev:50034] [Bug #13354] [Fix GH-1546] ### Before user system total real Fixnum 1.410000 0.000000 1.410000 ( 1.407848) Bignum 1.550000 0.000000 1.550000 ( 1.549145) ### After user system total real Fixnum 0.880000 0.000000 0.880000 ( 0.886662) Bignum 1.050000 0.000000 1.050000 ( 1.047994) ### Test code require 'benchmark' Benchmark.bmbm do |x| x.report "Fixnum" do t1 = Time.now t2 = Time.now 10000000.times do t1 <=> t2 end end x.report "Bignum" do t1 = Time.at(2 ** 64) t2 = Time.at(2 ** 64 + 1) 10000000.times do t1 <=> t2 end end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21Remove redundant square bracketskazu
Use character class directly instead of character class in character class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20erb.rb: Allow trimming CR in all trim_modesk0kubun
to unify a behavior with r58823 and r58825. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20erb.rb: Allow explicit trimming carriage returnk0kubun
when trim_mode is "-", for Windows environments. [ruby-core:39625] [Bug #5339] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20doc/maintainers.rdoc: Add me to ERB maintainersk0kubun
The current maintainer suggested this in ruby-dev:50113. Please ping me if an issue happens in ERB. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e