The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
I wrote an inliner

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
I wrote an inliner Posted: Jun 27, 2007 2:08 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: I wrote an inliner
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement
$ ruby test.rb 
caller result: 12
caller:
def caller
  v1 = (2 + 3)
  x = callee(v1)
  (x + 2)
end
callee:
def callee(v)
  (v + 5)
end
 
inline callee into caller
caller result: 12
caller:
def caller
  v1 = (2 + 3)
  x = (inline_callee_v = v1
  (inline_callee_v + 5))
  (x + 2)
end
$ ruby -Ilib bm.rb 
Rehearsal -------------------------------------------
empty     0.090000   0.000000   0.090000 (  0.083842)
plain     1.030000   0.010000   1.040000 (  1.037302)
inlined   0.810000   0.000000   0.810000 (  0.821394)
---------------------------------- total: 1.940000sec
 
              user     system      total        real
empty     0.080000   0.000000   0.080000 (  0.084179)
plain     1.100000   0.000000   1.100000 (  1.105742)
inlined   0.900000   0.000000   0.900000 (  0.900799)

Read: I wrote an inliner

Topic: Physical Feedback for CI and Bugs Previous Topic   Next Topic Topic: One ID to rule them all

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use