1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test
nobu 9bc73cd81f array.c: improve operations on small arrays
[Feature #13884]

Reduce number of memory allocations for "and", "or" and "diff"
operations on small arrays

Very often, arrays are used to filter parameters and to select
interesting items from 2 collections and very often these
collections are small enough, for example:

```ruby
SAFE_COLUMNS = [:id, :title, :created_at]

def columns
  @all_columns & SAFE_COLUMNS
end
```

In this patch, I got rid of unnecessary memory allocations for
small arrays when "and", "or" and "diff" operations are performed.

name             | HEAD  | PATCH
-----------------+------:+------:
array_small_and  | 0.615 | 0.263
array_small_diff | 0.676 | 0.282
array_small_or   | 0.953 | 0.463

name             | PATCH
-----------------+------:
array_small_and  | 2.343
array_small_diff | 2.392
array_small_or   | 2.056

name             | HEAD  | PATCH
-----------------+------:+------:
array_small_and  | 1.429 | 1.005
array_small_diff | 1.493 | 0.878
array_small_or   | 1.672 | 1.152

name             | PATCH
-----------------+------:
array_small_and  | 1.422
array_small_diff | 1.700
array_small_or   | 1.452

Author:    Dmitry Bochkarev <dimabochkarev@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-29 07:43:22 +00:00
..
-ext- test_dln.rb: fix path separator on MinGW 2017-09-28 13:55:48 +00:00
base64 lib/base64.rb: Specify frozen_string_literal: true. 2017-02-10 00:58:45 +00:00
benchmark
bigdecimal ruby.h: unnormalized Fixnum value 2017-09-07 03:24:08 +00:00
cgi Fix strange indentation 2017-05-18 15:13:30 +00:00
coverage test/coverage/test_coverage.rb: Refactor coverage tests. 2017-09-23 23:58:24 +00:00
csv test_features.rb: fix unused variable warning 2017-09-26 10:45:14 +00:00
date ruby.h: unnormalized Fixnum value 2017-09-07 03:24:08 +00:00
dbm
digest
drb test_drb.rb: removed extra spaces 2017-09-26 00:07:41 +00:00
dtrace rename ruby-runner as bin/ruby 2017-09-15 17:42:00 +00:00
erb test_erb.rb: add test cases for uncovered methods 2017-09-26 11:30:45 +00:00
etc
excludes
fiddle Use mutable strings for mutation tests. 2017-09-12 23:15:34 +00:00
fileutils test_fileutils.rb: rmdir should fail on nonexistent directory 2017-09-16 22:40:09 +00:00
gdbm Import gemspec and test file changes from ruby/gdbm. 2017-04-25 07:55:56 +00:00
io test_io_console.rb: flush 2017-09-28 02:51:41 +00:00
irb ruby-lex.rb: fix continued line conditions 2017-04-20 11:07:02 +00:00
json require 'bigdecimal' 2017-06-16 04:04:53 +00:00
lib assertions.rb: AllFailures#message encoding 2017-08-01 11:59:45 +00:00
logger logger.rb: Fix handling progname 2017-07-20 16:47:26 +00:00
matrix * lib/matrix.rb: Add Vector.zero and Vector#zero? 2017-03-14 20:09:30 +00:00
minitest test_minitest_unit.rb: assert_triggered 2017-03-29 09:47:40 +00:00
misc
mkmf test_framework.rb: for case-sensitive filesystem 2017-04-21 06:12:27 +00:00
monitor Add MonitorMinx#mon_locked? and #mon_owned? to check states of objects 2017-09-20 01:40:53 +00:00
net Net::HTTP.new: Support no_proxy parameter [Feature #11195] 2017-09-28 10:51:37 +00:00
nkf Fix test code of kconv 2017-09-15 16:56:16 +00:00
objspace ext/objspace/objspace.c: remove unneeded code clones. 2017-09-17 23:56:37 +00:00
open-uri
openssl openssl: import e72d960db262 2017-09-24 16:26:22 +00:00
optparse optparse.rb: case-sensitive candidate 2017-07-24 01:56:04 +00:00
ostruct ostruct.rb: refine visibility failure message 2017-03-28 09:21:58 +00:00
pathname pathname.rb: UNC root pathname needs a separator 2017-06-16 14:44:01 +00:00
psych Merge psych-3.0.0.beta3 from ruby/psych. 2017-07-14 06:15:58 +00:00
rdoc Removed needless magic-comment for encodings. 2017-09-13 09:06:34 +00:00
readline suppress warning: assigned but unused variable - line 2017-08-15 21:36:16 +00:00
resolv
rexml REXML: Fix a bug that unexpected methods can be called as a XPath function 2017-08-13 12:14:24 +00:00
rinda Stop a global server of Rinda test 2017-03-14 15:14:21 +00:00
ripper ripper: add states of scanner 2017-09-14 10:53:47 +00:00
rss rss: Accept empty text element as valid element 2017-05-03 12:25:17 +00:00
ruby array.c: improve operations on small arrays 2017-09-29 07:43:22 +00:00
rubygems gem.rb: load rubygems.rb 2017-09-24 09:35:09 +00:00
scanf
sdbm
shell test_command_processor.rb: add suffix 2017-06-23 15:08:50 +00:00
socket test/socket/test_basicsocket.rb (socks): bind explicitly to localhost 2017-05-15 07:33:10 +00:00
stringio stringio.c: encoding at empty chomped result 2017-08-13 07:31:49 +00:00
strscan strscan.c: fix segfault in aref 2017-07-21 13:30:46 +00:00
syslog
testunit test_parallel.rb: match the count 2017-02-07 08:09:23 +00:00
thread test/thread: relax internal implementation check in error message 2017-05-09 19:52:10 +00:00
uri URI::Generic: Separate no_proxy handling 2017-09-28 10:51:31 +00:00
webrick lib/webrick/log.rb: sanitize any type of logs 2017-09-14 11:16:23 +00:00
win32ole test/win32ole/test_word.rb: word quit without confirmation dialog to save 2017-09-13 13:24:59 +00:00
yaml
zlib Zlib::GzipReader#pos underflows after calling #ungetbyte or #ungetc at start of file [Bug #13616] 2017-07-14 09:17:55 +00:00
colors
runner.rb the working directory may not be srcdir 2017-09-07 17:45:34 +00:00
test_abbrev.rb lib/abbrev.rb: Specify frozen_string_literal: true. 2017-02-09 16:12:00 +00:00
test_cmath.rb
test_delegate.rb Delegate to eql? [Fix GH-1564] 2017-06-24 03:35:29 +00:00
test_extlibs.rb Revert "test/test_extilibs.rb: do not check the existence of fiddle" 2017-05-16 23:59:01 +00:00
test_find.rb lib/find.rb: Specify frozen_string_literal: true. 2017-02-13 12:16:26 +00:00
test_forwardable.rb
test_ipaddr.rb
test_mutex_m.rb
test_observer.rb
test_open3.rb
test_pp.rb
test_prettyprint.rb
test_prime.rb prime.rb: remove alias after timeout test 2017-05-20 10:21:44 +00:00
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb Update a test of SecureRandom according to r57384 2017-09-09 15:12:10 +00:00
test_set.rb Alias Set#=== to #include? 2017-09-19 08:45:12 +00:00
test_shellwords.rb
test_singleton.rb
test_syslog.rb
test_tempfile.rb Of course, opened file is not able to unlink on Windows 2017-05-19 12:44:46 +00:00
test_time.rb
test_timeout.rb
test_tmpdir.rb
test_tracer.rb
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb
test_win32api.rb