From: Eric Wong Date: 2014-10-08T02:00:40+00:00 Subject: [ruby-core:65502] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string Eric Wong wrote: > ko1@atdot.net 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