Issue #12996 has been updated by Yuki Kurihara. Yes, I tryed alias way. But it was vary slow. And another issue appeared. ``` $ time ./miniruby t.rb ./miniruby t.rb 1.80s user 0.02s system 98% cpu 1.842 total $ make test-all TESTS="test/ruby/test_range.rb" CC = clang LD = ld LDSHARED = clang -dynamic -bundle CFLAGS = -O0 -fno-fast-math -g3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Werror=implicit-int -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -Werror=division-by-zero -Werror=deprecated-declarations -Werror=extra-tokens -pipe XCFLAGS = -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin15 -I./include -I. -I./enc/unicode/9.0.0 DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework CoreFoundation SOLIBS = -lgmp Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin generating known_errors.inc known_errors.inc unchanged Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/memory_leak/ # Running tests: [21/42] TestRange#test_eqq_time = 0.00 s 1) Failure: TestRange#test_eqq_time [/Users/yuki/src/github.com/ksss/ruby/test/ruby/test_range.rb:328]: [ruby-core:69052] [Bug #11113]. Exception raised: <#<TypeError: can't iterate from Time>> ``` ---------------------------------------- Feature #12996: Optimize Range#=== https://bugs.ruby-lang.org/issues/12996#change-61858 * Author: Yuki Kurihara * Status: Open * Priority: Normal * Assignee: ---------------------------------------- The proposal is that Range#=== optimize by reducing method calls. ## Benchmark ~~~shell $ cat t.rb i = 0 while i < 1_000_000 case i when 1..1000 end i += 1 end ~~~ ~~~ $ time ./miniruby -e 1 ./miniruby -e 1 0.01s user 0.00s system 85% cpu 0.013 total ~~~ ### Before ~~~ $ time ./miniruby t.rb ./miniruby t.rb 0.60s user 0.00s system 99% cpu 0.605 total ~~~ ### After ~~~ $ time ./miniruby t.rb ./miniruby t.rb 0.41s user 0.00s system 99% cpu 0.420 total ~~~ ## Important point Break compatibility in this case. https://github.com/ruby/ruby/blob/80045bc2a9e12012d6d16517ea5cb037e67eb2c1/test/ruby/test_range.rb#L333-L355 I don't know how to fix this issue. But I think, This is a key sentence maybe. https://github.com/ruby/ruby/blob/8130ee5c9dea6d1323d41271cc01c8dc5d8bcc5d/range.c#L1176 ---Files-------------------------------- range-eqq.patch (1.35 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>