[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65502] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string

From: Eric Wong <normalperson@...>
Date: 2014-10-08 02:00:40 UTC
List: ruby-core #65502
Eric Wong <[email protected]> wrote:
> [email protected] wrote:
> > Another idea is to make more general approach to indicate arguments
> > (and a receiver) are string literal. It is called specialization.
> > Specialized instructions (opt_plus and so on) is a kind of
> > specialization by hands.
> 
> I've been thinking along these lines, too.  For example, I would like to
> see String#tr! and String#gsub! able to avoid allocations for literal
> strings.  Or even optimize: Time.now.{to_f,to_i,strftime("lit"))}

Maybe start moving existing iseq_compile_each optimizations to the
peephole optimizer (work-in-progress):
http://80x24.org/spew/m/ee49aae645e0953fc16fc1557dce6a09b4de4324.txt

In This Thread