summaryrefslogtreecommitdiff
path: root/common.mk
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-11-18 15:10:20 -0800
committerGitHub <noreply@github.com>2021-11-18 15:10:20 -0800
commitb08dacfea39ad8da3f1fd7fdd0e4538cc892ec44 (patch)
tree0e3ab7e2f068ce840aaa4e3cbb46e2561a7c153e /common.mk
parent4adb012926f8bd6011168327d8832cf19976de40 (diff)
Optimize dynamic string interpolation for symbol/true/false/nil/0-9
This provides a significant speedup for symbol, true, false, nil, and 0-9, class/module, and a small speedup in most other cases. Speedups (using included benchmarks): :symbol :: 60% 0-9 :: 50% Class/Module :: 50% nil/true/false :: 20% integer :: 10% [] :: 10% "" :: 3% One reason this approach is faster is it reduces the number of VM instructions for each interpolated value. Initial idea, approach, and benchmarks from Eric Wong. I applied the same approach against the master branch, updating it to handle the significant internal changes since this was first proposed 4 years ago (such as CALL_INFO/CALL_CACHE -> CALL_DATA). I also expanded it to optimize true/false/nil/0-9/class/module, and added handling of missing methods, refined methods, and RUBY_DEBUG. This renames the tostring insn to anytostring, and adds an objtostring insn that implements the optimization. This requires making a few functions non-static, and adding some non-static functions. This disables 4 YJIT tests. Those tests should be reenabled after YJIT optimizes the new objtostring insn. Implements [Feature #13715] Co-authored-by: Eric Wong <e@80x24.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: Yusuke Endoh <mame@ruby-lang.org> Co-authored-by: Koichi Sasada <ko1@atdot.net>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5002 Merged-By: jeremyevans <code@jeremyevans.net>
Diffstat (limited to 'common.mk')
-rw-r--r--common.mk2
1 files changed, 2 insertions, 0 deletions
diff --git a/common.mk b/common.mk
index c840ec654d..714882a9b0 100644
--- a/common.mk
+++ b/common.mk
@@ -9522,6 +9522,7 @@ numeric.$(OBJEXT): $(top_srcdir)/internal/hash.h
numeric.$(OBJEXT): $(top_srcdir)/internal/numeric.h
numeric.$(OBJEXT): $(top_srcdir)/internal/object.h
numeric.$(OBJEXT): $(top_srcdir)/internal/rational.h
+numeric.$(OBJEXT): $(top_srcdir)/internal/string.h
numeric.$(OBJEXT): $(top_srcdir)/internal/serial.h
numeric.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
numeric.$(OBJEXT): $(top_srcdir)/internal/util.h
@@ -9598,6 +9599,7 @@ numeric.$(OBJEXT): {$(VPATH)}internal/compiler_is/intel.h
numeric.$(OBJEXT): {$(VPATH)}internal/compiler_is/msvc.h
numeric.$(OBJEXT): {$(VPATH)}internal/compiler_is/sunpro.h
numeric.$(OBJEXT): {$(VPATH)}internal/compiler_since.h
+numeric.$(OBJEXT): {$(VPATH)}internal/compilers.h
numeric.$(OBJEXT): {$(VPATH)}internal/config.h
numeric.$(OBJEXT): {$(VPATH)}internal/constant_p.h
numeric.$(OBJEXT): {$(VPATH)}internal/core.h