SlideShare une entreprise Scribd logo
1  sur  56
RubyKaigi 2007 Session



C                      Ruby
    An Example of Ruby Program Faster Than C




                  makoto kuwata
           http://www.kuwata-lab.com


           copyright(c) 2007 kuwata-lab.com all rights reserved.
…



copyright(c) 2007 kuwata-lab.com all rights reserved.
2007
         Script Languages in 2007




       copyright(c) 2007 kuwata-lab.com all rights reserved.
PS3
         Break Away from PS3 Syndrome




‣ PS3/PSP …
  •

‣ Wii/DS …
  •


           copyright(c) 2007 kuwata-lab.com all rights reserved.
Script Languages can't be Center Player


‣                                                                 Java
    • Java
    •                                                          ≠


‣
    •
    •
              copyright(c) 2007 kuwata-lab.com all rights reserved.
Problems and Truth about Script Languages




✓

✓

✓



           copyright(c) 2007 kuwata-lab.com all rights reserved.
About This Presentation




copyright(c) 2007 kuwata-lab.com all rights reserved.
Point




                      ≠
Language Speed ≠ Application Speed




      copyright(c) 2007 kuwata-lab.com all rights reserved.
Overview



‣   :

‣   : C                       Ruby

‣   : eRuby

‣   :                    C
        ≦                              Ruby
        ≪≪≪≪≪                                                     C


          copyright(c) 2007 kuwata-lab.com all rights reserved.
Conclusion



‣

    •

‣
    •


        copyright(c) 2007 kuwata-lab.com all rights reserved.
eRuby
     Introduction to eRuby




 copyright(c) 2007 kuwata-lab.com all rights reserved.
eRuby
                       What is eRuby?


‣   eRuby (Embedded Ruby) …
                                           Ruby                      (   )


‣   eRuby                  …
     Ruby
            Ruby
       • eruby … C
       • ERB … pure Ruby Ruby1.8
             copyright(c) 2007 kuwata-lab.com all rights reserved.
Example


<table>
 <tbody>
<% for item in list %>
  <tr>
    <td><%= item %></td>
  </tr>
<% end %>
 </tbody>            <% ... ... %>
<table>              <%= ... ... %>



      copyright(c) 2007 kuwata-lab.com all rights reserved.
C         eruby
        Ruby Script Translated by eruby


print "<table>n"
print " <tbody>n"
 for item in list ; print "n"
print " <tr>n"
print " <td>"; print(( item )); print "</td>n"
print " </tr>n"
 end ; print "n"
print " </tbody>n"                print
print "<table>n"                  1


          copyright(c) 2007 kuwata-lab.com all rights reserved.
ERB
              Ruby Script Translated by ERB

_erbout = ""; _erbout.concat "<table>n"
_erbout.concat " <tbody>n"
 for item in list ; _erbout.concat "n"
_erbout.concat " <tr>n"
_erbout.concat " <td>"; _erbout.concat(( item ).to_s);
_erbout.concat "</td>n"
_erbout.concat " </tr>n"
 end ; _erbout.concat "n"
_erbout.concat " </tbody>n"
_erbout.concat "<table>n"
_erbout                                  1
               copyright(c) 2007 kuwata-lab.com all rights reserved.
Output Example

<table>
 <tbody>
  <tr>
    <td>AAA</td>
  </tr>
  <tr>
    <td>BBB</td>
  </tr>
  <tr>
    <td>CCC</td>
  </tr>
 </tbody>        :
<table>

   copyright(c) 2007 kuwata-lab.com all rights reserved.
Benchmark Environment


                                              1: <html>
‣ 400                                            .....                  : 53
 10,000                                      53: <table>
                                             54: <% for item in list %>
                                             55: <tr>
‣ 10                                         56: <td><%= item['symbol'] %></td>
                                             57: <td><%= item['name'] %></td>
‣ MacOS X 10.4 Tiger                             .....
                                             79: </tr>                  : 17
 (CoreDuo 1.83GHz)                                                      x20
                                             80: <% end %>
‣ Ruby 1.8.6, eruby 1.0.5                    81: </table>
                                                 .....                   :5
                                             85: </html>

                 copyright(c) 2007 kuwata-lab.com all rights reserved.
Benchmark Result



50.0


37.5


25.0


12.5


  0
       C     eruby                                         ERB

           copyright(c) 2007 kuwata-lab.com all rights reserved.
#1:
MyEruby#1: First Implementation




  copyright(c) 2007 kuwata-lab.com all rights reserved.
#1:
            #1: First Implementation


 ### Program
   input.each_line do |line|
      line.scan(/(.*?)(<%=?|%>)/) do
        case $2
        when '<%' ; ...              1
        when '<%=' ; ...
        when '%>' ; ...
        ...
      end
   end
   ...
http://www.kuwata-lab.com/presen/erubybench-1.1.zip
           copyright(c) 2007 kuwata-lab.com all rights reserved.
#1:                                                      (2)
           #1: First Implementation (2)


                                    Ruby
### Translated
_buf = ""; _buf << "<html>n";
_buf << "<body>n"                1
_buf << " <table>n"
 for item in list ; _buf << "n";
_buf << " <tr>n"
_buf << " <td>"; _buf << (item['name']).to_s;
_buf << "</td>n";
_buf << " </tr>n";
 end ; _buf << "n";
...
            copyright(c) 2007 kuwata-lab.com all rights reserved.
#1:
                    #1: Benchmark Result



100


 75


 50


 25


  0
      C     eruby                      ERB                          MyEruby1

                copyright(c) 2007 kuwata-lab.com all rights reserved.
#2:
       #2: Never Split Into Lines




      copyright(c) 2007 kuwata-lab.com all rights reserved.
#2:
           #2: Never Split into Lines


## Before
  input.each_line do |line|
    line.scan(/(.*?)(<%=?|%>)/).each do
      ...
    end
  end

## After
  input.scan(/(.*?)(<%=?|%>)/m).each do
    ...
  end

          copyright(c) 2007 kuwata-lab.com all rights reserved.
#2:                                                               (2)
         #2: Never Split into Lines (2)



                                                         Ruby
## Before
_buf << "<html>n"
_buf << " <body>n"
_buf << " <h1>title</h1>n"

## After
_buf << '<html>
 <body>
   <h1>title</h1>
';

          copyright(c) 2007 kuwata-lab.com all rights reserved.
#2:
                          #2: Benchmark Result




100


 75


 50


 25


  0
      C    eruby             ERB                  MyEruby1                 MyEruby2

                   copyright(c) 2007 kuwata-lab.com all rights reserved.
#2:
                  #2: Benchmark Result




20


15


10


 5


 0
       C      eruby                                    MyEruby2

           copyright(c) 2007 kuwata-lab.com all rights reserved.
#3:
  #3: Replace Parsing with Pattern Matching




         copyright(c) 2007 kuwata-lab.com all rights reserved.
#3:
       #3: Replace Parsing with Pattern Matching

## Before
input.scan(/(.*?)(<%=?|%>)/m) do
  case $2
  when '<%=' ; kind = :expr
  when '<%' ; kind = :stmt
  when '%>' ; kind = :text
  ...

## After
input.scan(/(.*?)<%(=?)(.*?)%>/m) do
  text, equal, code = $1, $2, $3
  s << _convert_str(text, :text)
  s << _convert_str(code, equal=='=' ? :expr : :stmt)
  ...
              copyright(c) 2007 kuwata-lab.com all rights reserved.
#3:
                   #3: Benchmark Result



20


15


10


 5


 0
      C    eruby                 MyEruby2                            MyEruby3

             copyright(c) 2007 kuwata-lab.com all rights reserved.
#4:
      #4: Tune Up Regular Expressions




        copyright(c) 2007 kuwata-lab.com all rights reserved.
#4:
         #4: Tune Up Regular Expressions

## Before
input.scan(/(.*?)<%(=)?(.*?)%>/m) do
  text, equal, code = $1, $2, $3
  ...

## After
pos = 0
input.scan(/<%(=)?(.*?)%>/m) do
  equal, code = $1, $2
  match = Regexp.last_match
  len = match.begin(0) - pos
  text = eruby_str[pos, len]
  pos = match.end(0)
  ...
            copyright(c) 2007 kuwata-lab.com all rights reserved.
#4:
                      #4: Benchmark Result




20


15


10


 5


 0
     C    eruby       MyEruby2                 MyEruby3                MyEruby4

               copyright(c) 2007 kuwata-lab.com all rights reserved.
#5:
  #5: Inline Expansion of Method Call




      copyright(c) 2007 kuwata-lab.com all rights reserved.
#5:
        #5: Inline Expansion of Method Call

### Before
    ...
    s << _convert_str(code, :expr)
    s << _convert_str(code, :stmt)
    s << _convert_str(text, :text)
    ...

### After
    ...
    s << "_buf << (#{code}).to_s; "
    s << "#{code}; "
    s << "_buf << '#{text.gsub(/[']/, '&')}'; "
    ...
             copyright(c) 2007 kuwata-lab.com all rights reserved.
#5:
                      #5: Benchmark Result




20


15


10


 5


 0
     C    eruby MyEruby2           MyEruby3            MyEruby4        MyEruby5

               copyright(c) 2007 kuwata-lab.com all rights reserved.
#6:
                 #6: Array Buffer




      copyright(c) 2007 kuwata-lab.com all rights reserved.
#6:
                       #6: Array Buffer


                                                                      Ruby
### Before
_buf = '';
_buf << '<td>'; _buf << (n).to_s; _buf << '</td>';
_buf

### After                                                         String#<<
_buf = [];                                        1            Array#push()
_buf.push('<td>', n, '</td>');
_buf.join



              copyright(c) 2007 kuwata-lab.com all rights reserved.
#6:
                      #6: Benchmark Result



20


15


10


 5


 0
           by



                       2



                                       3



                                                        4



                                                                        5



                                                                                   6
                    by



                                    by



                                                     by



                                                                     by



                                                                                by
            u
         er



                 ru



                                 ru



                                                  ru



                                                                  ru



                                                                             ru
                 yE



                              yE



                                              yE



                                                               yE



                                                                             yE
                M



                             M



                                             M



                                                              M



                 copyright(c) 2007 kuwata-lab.com all rights reserved.      M
     C
#7:
          #7: Interpolation




copyright(c) 2007 kuwata-lab.com all rights reserved.
#7:
                   #7: Interpolation


                                                                  Ruby
### Before
_buf << '<tr>
<td>'; _buf << (n).to_s; _buf << '</td>
</tr>';
                                                            String#<<
### After
_buf << %Q`<tr>
<td>#{n}</td>
                                             "...str..."
</tr>`
                                             %Q`...str...`



          copyright(c) 2007 kuwata-lab.com all rights reserved.
#7:
                        #7: Benchmark Result




20


15


10


 5


 0
             y


                    2


                                3


                                              4


                                                             5


                                                                            6


                                                                                      7
           ub


                 by


                             by


                                           by


                                                          by


                                                                         by


                                                                                   by
         er


                ru


                           ru


                                       ru


                                                      ru


                                                                    ru


                                                                                   ru
              yE


                         yE


                                     yE


                                                    yE


                                                                  yE


                                                                                 yE
             M


                        M


                                    M


                                                   M


                                                                 M


                 copyright(c) 2007 kuwata-lab.com all rights reserved.
                                                                                M
     C
#8:
                  #7: File Caching




      copyright(c) 2007 kuwata-lab.com all rights reserved.
#8:
                      #8: File Caching


## After
def convert_file(filename, cachename=nil)
 cachename ||= filename + '.cache'
 if                               or
    prog = convert(File.read(filename))
                                     (prog)
 else
    prog =
 end
 return prog                    Ruby
end

            copyright(c) 2007 kuwata-lab.com all rights reserved.
#8:
               #8: Benchmark Result



20


15


10


 5


 0
               y

               2


               3


               4


               5


               6


               7


               8
           ub

            by


            by


            by


            by


            by


            by


            by
         er

        ru


        ru


        ru


        ru


        ru


        ru


        ru
      yE


      yE


      yE


      yE


      yE


      yE


      yE
     M


     M


     M


     M


     M


     M


     M
           copyright(c) 2007 kuwata-lab.com all rights reserved.
 C
#9:
          #7: Make Methods




  copyright(c) 2007 kuwata-lab.com all rights reserved.
#9:
                      #9: Make Methods

### Before
 prog = myeruby.convert_file(filename)
 eval prog

### After                  Ruby
 def define_method(body, args=[])
  eval "def self.evaluate(#{args.join(',')}); #{body}; end"
 end
 prog = myeruby.convert_file(filename)
 args = ['list']
 myeruby.define_method(prog, args)
 myeruby.evaluate()
              copyright(c) 2007 kuwata-lab.com all rights reserved.
#9:
               #9: Benchmark Result



20


15


10


 5


 0
               y

               2

               3

               4

               5

               6

               7

               8

               9
           ub

            by

            by

            by

            by

            by

            by

            by

            by
         er

        ru

        ru

        ru

        ru

        ru

        ru

        ru

        ru
      yE

      yE

      yE

      yE

      yE

      yE

      yE

      yE
     M

     M

     M

     M

     M

     M

     M

     M
           copyright(c) 2007 kuwata-lab.com all rights reserved.
 C
Principles of Tuning
                                                                     :
#
#2                   1                                      69.17
#8                                                          2.44
#9                                                                  2.26
#2                                          1                       4.91
#5                                                          2.11
#6                                     Array#push()                 0.94
#7                                                                  0.94
#3                                                          4.20
#4                                                          2.12
    copyright(c) 2007 kuwata-lab.com all rights reserved.
Comparison with Competitors

 Lang                        Solution                              Time(sec)
Ruby      eruby                                                      15.32
          ERB                                                        42.67
          MyEruby7 (interporation)                                   10.42
          MyEruby8 (cached)                                          8.02
          MyEruby9 (method)                                          5.11
 Perl     Template-Toolkit                                           26.40

Python    Django                                                     50.55
          Kid (TurboGears)                                          344.16
 Java     Jakarta Velocity                                           13.24
           copyright(c) 2007 kuwata-lab.com all rights reserved.
Summary




copyright(c) 2007 kuwata-lab.com all rights reserved.
Result



‣C      1.5                    Ruby
    •                        2                                    3

    •

‣
    •    Java             Ruby


          copyright(c) 2007 kuwata-lab.com all rights reserved.
Conclusion



‣

    •

‣
    •


        copyright(c) 2007 kuwata-lab.com all rights reserved.
one more minute...



   copyright(c) 2007 kuwata-lab.com all rights reserved.
Erubis

             •    ERB             3          eruby              10%
             •
eRuby        •                                            <% %>
             •    <%= %>               HTML escape
             •    YAML
             •    Ruby
             •                               (C/Java/PHP/Perl/Scheme/JavaSript)

            • RoR                                       30%           (    )


        copyright(c) 2007 kuwata-lab.com all rights reserved.
thank you



copyright(c) 2007 kuwata-lab.com all rights reserved.

Contenu connexe

Tendances

Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in PerlLaurent Dami
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015Fernando Hamasaki de Amorim
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)ngotogenome
 
Advanced python
Advanced pythonAdvanced python
Advanced pythonEU Edge
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)James Titcumb
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPANcharsbar
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Pythonkwatch
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaPatrick Allaert
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS charsbar
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsMichael Pirnat
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objectsjulien pauli
 
閒聊Python應用在game server的開發
閒聊Python應用在game server的開發閒聊Python應用在game server的開發
閒聊Python應用在game server的開發Eric Chen
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?Nikita Popov
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Fwdays
 
NativeBoost
NativeBoostNativeBoost
NativeBoostESUG
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...James Titcumb
 
Interceptors: Into the Core of Pedestal
Interceptors: Into the Core of PedestalInterceptors: Into the Core of Pedestal
Interceptors: Into the Core of PedestalKent Ohashi
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Wen-Tien Chang
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2Zaar Hai
 

Tendances (20)

Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
 
Advanced python
Advanced pythonAdvanced python
Advanced python
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPAN
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Python
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 Verona
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
 
閒聊Python應用在game server的開發
閒聊Python應用在game server的開發閒聊Python應用在game server的開發
閒聊Python應用在game server的開發
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
 
NativeBoost
NativeBoostNativeBoost
NativeBoost
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
 
Interceptors: Into the Core of Pedestal
Interceptors: Into the Core of PedestalInterceptors: Into the Core of Pedestal
Interceptors: Into the Core of Pedestal
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2
 

Similaire à Cより速いRubyプログラム

The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9tomaspavelka
 
Quick Intro To JRuby
Quick Intro To JRubyQuick Intro To JRuby
Quick Intro To JRubyFrederic Jean
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingBozhidar Batsov
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介kwatch
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mrubyHiroshi SHIBATA
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processguest3379bd
 
RubyEnRails2007 - Dr Nic Williams - DIY Syntax
RubyEnRails2007 - Dr Nic Williams - DIY SyntaxRubyEnRails2007 - Dr Nic Williams - DIY Syntax
RubyEnRails2007 - Dr Nic Williams - DIY SyntaxDr Nic Williams
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Scott Keck-Warren
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 

Similaire à Cより速いRubyプログラム (20)

The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
Quick Intro To JRuby
Quick Intro To JRubyQuick Intro To JRuby
Quick Intro To JRuby
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programing
 
Ruby 1.9
Ruby 1.9Ruby 1.9
Ruby 1.9
 
New features in Ruby 2.5
New features in Ruby 2.5New features in Ruby 2.5
New features in Ruby 2.5
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介
 
Sinatra
SinatraSinatra
Sinatra
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mruby
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
RubyEnRails2007 - Dr Nic Williams - DIY Syntax
RubyEnRails2007 - Dr Nic Williams - DIY SyntaxRubyEnRails2007 - Dr Nic Williams - DIY Syntax
RubyEnRails2007 - Dr Nic Williams - DIY Syntax
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Debugging TV Frame 0x13
Debugging TV Frame 0x13Debugging TV Frame 0x13
Debugging TV Frame 0x13
 

Plus de kwatch

How to make the fastest Router in Python
How to make the fastest Router in PythonHow to make the fastest Router in Python
How to make the fastest Router in Pythonkwatch
 
Migr8.rb チュートリアル
Migr8.rb チュートリアルMigr8.rb チュートリアル
Migr8.rb チュートリアルkwatch
 
なんでもID
なんでもIDなんでもID
なんでもIDkwatch
 
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方kwatch
 
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方kwatch
 
O/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐO/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐkwatch
 
正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?kwatch
 
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)kwatch
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!kwatch
 
PHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するPHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するkwatch
 
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?kwatch
 
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策kwatch
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門kwatch
 
Pretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/MercurialPretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/Mercurialkwatch
 
Oktest - a new style testing library for Python -
Oktest - a new style testing library for Python -Oktest - a new style testing library for Python -
Oktest - a new style testing library for Python -kwatch
 
文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみたkwatch
 
I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"kwatch
 
Javaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンJavaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンkwatch
 
Underlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R MapperUnderlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R Mapperkwatch
 
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -kwatch
 

Plus de kwatch (20)

How to make the fastest Router in Python
How to make the fastest Router in PythonHow to make the fastest Router in Python
How to make the fastest Router in Python
 
Migr8.rb チュートリアル
Migr8.rb チュートリアルMigr8.rb チュートリアル
Migr8.rb チュートリアル
 
なんでもID
なんでもIDなんでもID
なんでもID
 
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
 
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
 
O/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐO/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐ
 
正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?
 
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!
 
PHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するPHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較する
 
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
 
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門
 
Pretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/MercurialPretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/Mercurial
 
Oktest - a new style testing library for Python -
Oktest - a new style testing library for Python -Oktest - a new style testing library for Python -
Oktest - a new style testing library for Python -
 
文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた
 
I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"
 
Javaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンJavaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジン
 
Underlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R MapperUnderlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R Mapper
 
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -
How to Make Ruby CGI Script Faster - CGIを高速化する小手先テクニック -
 

Dernier

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Cより速いRubyプログラム

  • 1. RubyKaigi 2007 Session C Ruby An Example of Ruby Program Faster Than C makoto kuwata http://www.kuwata-lab.com copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 3. 2007 Script Languages in 2007 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 4. PS3 Break Away from PS3 Syndrome ‣ PS3/PSP … • ‣ Wii/DS … • copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 5. Script Languages can't be Center Player ‣ Java • Java • ≠ ‣ • • copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 6. Problems and Truth about Script Languages ✓ ✓ ✓ copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 7. About This Presentation copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 8. Point ≠ Language Speed ≠ Application Speed copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 9. Overview ‣ : ‣ : C Ruby ‣ : eRuby ‣ : C ≦ Ruby ≪≪≪≪≪ C copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 10. Conclusion ‣ • ‣ • copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 11. eRuby Introduction to eRuby copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 12. eRuby What is eRuby? ‣ eRuby (Embedded Ruby) … Ruby ( ) ‣ eRuby … Ruby Ruby • eruby … C • ERB … pure Ruby Ruby1.8 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 13. Example <table> <tbody> <% for item in list %> <tr> <td><%= item %></td> </tr> <% end %> </tbody> <% ... ... %> <table> <%= ... ... %> copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 14. C eruby Ruby Script Translated by eruby print "<table>n" print " <tbody>n" for item in list ; print "n" print " <tr>n" print " <td>"; print(( item )); print "</td>n" print " </tr>n" end ; print "n" print " </tbody>n" print print "<table>n" 1 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 15. ERB Ruby Script Translated by ERB _erbout = ""; _erbout.concat "<table>n" _erbout.concat " <tbody>n" for item in list ; _erbout.concat "n" _erbout.concat " <tr>n" _erbout.concat " <td>"; _erbout.concat(( item ).to_s); _erbout.concat "</td>n" _erbout.concat " </tr>n" end ; _erbout.concat "n" _erbout.concat " </tbody>n" _erbout.concat "<table>n" _erbout 1 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 16. Output Example <table> <tbody> <tr> <td>AAA</td> </tr> <tr> <td>BBB</td> </tr> <tr> <td>CCC</td> </tr> </tbody> : <table> copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 17. Benchmark Environment 1: <html> ‣ 400 ..... : 53 10,000 53: <table> 54: <% for item in list %> 55: <tr> ‣ 10 56: <td><%= item['symbol'] %></td> 57: <td><%= item['name'] %></td> ‣ MacOS X 10.4 Tiger ..... 79: </tr> : 17 (CoreDuo 1.83GHz) x20 80: <% end %> ‣ Ruby 1.8.6, eruby 1.0.5 81: </table> ..... :5 85: </html> copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 18. Benchmark Result 50.0 37.5 25.0 12.5 0 C eruby ERB copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 19. #1: MyEruby#1: First Implementation copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 20. #1: #1: First Implementation ### Program input.each_line do |line| line.scan(/(.*?)(<%=?|%>)/) do case $2 when '<%' ; ... 1 when '<%=' ; ... when '%>' ; ... ... end end ... http://www.kuwata-lab.com/presen/erubybench-1.1.zip copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 21. #1: (2) #1: First Implementation (2) Ruby ### Translated _buf = ""; _buf << "<html>n"; _buf << "<body>n" 1 _buf << " <table>n" for item in list ; _buf << "n"; _buf << " <tr>n" _buf << " <td>"; _buf << (item['name']).to_s; _buf << "</td>n"; _buf << " </tr>n"; end ; _buf << "n"; ... copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 22. #1: #1: Benchmark Result 100 75 50 25 0 C eruby ERB MyEruby1 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 23. #2: #2: Never Split Into Lines copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 24. #2: #2: Never Split into Lines ## Before input.each_line do |line| line.scan(/(.*?)(<%=?|%>)/).each do ... end end ## After input.scan(/(.*?)(<%=?|%>)/m).each do ... end copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 25. #2: (2) #2: Never Split into Lines (2) Ruby ## Before _buf << "<html>n" _buf << " <body>n" _buf << " <h1>title</h1>n" ## After _buf << '<html> <body> <h1>title</h1> '; copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 26. #2: #2: Benchmark Result 100 75 50 25 0 C eruby ERB MyEruby1 MyEruby2 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 27. #2: #2: Benchmark Result 20 15 10 5 0 C eruby MyEruby2 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 28. #3: #3: Replace Parsing with Pattern Matching copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 29. #3: #3: Replace Parsing with Pattern Matching ## Before input.scan(/(.*?)(<%=?|%>)/m) do case $2 when '<%=' ; kind = :expr when '<%' ; kind = :stmt when '%>' ; kind = :text ... ## After input.scan(/(.*?)<%(=?)(.*?)%>/m) do text, equal, code = $1, $2, $3 s << _convert_str(text, :text) s << _convert_str(code, equal=='=' ? :expr : :stmt) ... copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 30. #3: #3: Benchmark Result 20 15 10 5 0 C eruby MyEruby2 MyEruby3 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 31. #4: #4: Tune Up Regular Expressions copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 32. #4: #4: Tune Up Regular Expressions ## Before input.scan(/(.*?)<%(=)?(.*?)%>/m) do text, equal, code = $1, $2, $3 ... ## After pos = 0 input.scan(/<%(=)?(.*?)%>/m) do equal, code = $1, $2 match = Regexp.last_match len = match.begin(0) - pos text = eruby_str[pos, len] pos = match.end(0) ... copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 33. #4: #4: Benchmark Result 20 15 10 5 0 C eruby MyEruby2 MyEruby3 MyEruby4 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 34. #5: #5: Inline Expansion of Method Call copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 35. #5: #5: Inline Expansion of Method Call ### Before ... s << _convert_str(code, :expr) s << _convert_str(code, :stmt) s << _convert_str(text, :text) ... ### After ... s << "_buf << (#{code}).to_s; " s << "#{code}; " s << "_buf << '#{text.gsub(/[']/, '&')}'; " ... copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 36. #5: #5: Benchmark Result 20 15 10 5 0 C eruby MyEruby2 MyEruby3 MyEruby4 MyEruby5 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 37. #6: #6: Array Buffer copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 38. #6: #6: Array Buffer Ruby ### Before _buf = ''; _buf << '<td>'; _buf << (n).to_s; _buf << '</td>'; _buf ### After String#<< _buf = []; 1 Array#push() _buf.push('<td>', n, '</td>'); _buf.join copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 39. #6: #6: Benchmark Result 20 15 10 5 0 by 2 3 4 5 6 by by by by by u er ru ru ru ru ru yE yE yE yE yE M M M M copyright(c) 2007 kuwata-lab.com all rights reserved. M C
  • 40. #7: #7: Interpolation copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 41. #7: #7: Interpolation Ruby ### Before _buf << '<tr> <td>'; _buf << (n).to_s; _buf << '</td> </tr>'; String#<< ### After _buf << %Q`<tr> <td>#{n}</td> "...str..." </tr>` %Q`...str...` copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 42. #7: #7: Benchmark Result 20 15 10 5 0 y 2 3 4 5 6 7 ub by by by by by by er ru ru ru ru ru ru yE yE yE yE yE yE M M M M M copyright(c) 2007 kuwata-lab.com all rights reserved. M C
  • 43. #8: #7: File Caching copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 44. #8: #8: File Caching ## After def convert_file(filename, cachename=nil) cachename ||= filename + '.cache' if or prog = convert(File.read(filename)) (prog) else prog = end return prog Ruby end copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 45. #8: #8: Benchmark Result 20 15 10 5 0 y 2 3 4 5 6 7 8 ub by by by by by by by er ru ru ru ru ru ru ru yE yE yE yE yE yE yE M M M M M M M copyright(c) 2007 kuwata-lab.com all rights reserved. C
  • 46. #9: #7: Make Methods copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 47. #9: #9: Make Methods ### Before prog = myeruby.convert_file(filename) eval prog ### After Ruby def define_method(body, args=[]) eval "def self.evaluate(#{args.join(',')}); #{body}; end" end prog = myeruby.convert_file(filename) args = ['list'] myeruby.define_method(prog, args) myeruby.evaluate() copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 48. #9: #9: Benchmark Result 20 15 10 5 0 y 2 3 4 5 6 7 8 9 ub by by by by by by by by er ru ru ru ru ru ru ru ru yE yE yE yE yE yE yE yE M M M M M M M M copyright(c) 2007 kuwata-lab.com all rights reserved. C
  • 49. Principles of Tuning : # #2 1 69.17 #8 2.44 #9 2.26 #2 1 4.91 #5 2.11 #6 Array#push() 0.94 #7 0.94 #3 4.20 #4 2.12 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 50. Comparison with Competitors Lang Solution Time(sec) Ruby eruby 15.32 ERB 42.67 MyEruby7 (interporation) 10.42 MyEruby8 (cached) 8.02 MyEruby9 (method) 5.11 Perl Template-Toolkit 26.40 Python Django 50.55 Kid (TurboGears) 344.16 Java Jakarta Velocity 13.24 copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 52. Result ‣C 1.5 Ruby • 2 3 • ‣ • Java Ruby copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 53. Conclusion ‣ • ‣ • copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 54. one more minute... copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 55. Erubis • ERB 3 eruby 10% • eRuby • <% %> • <%= %> HTML escape • YAML • Ruby • (C/Java/PHP/Perl/Scheme/JavaSript) • RoR 30% ( ) copyright(c) 2007 kuwata-lab.com all rights reserved.
  • 56. thank you copyright(c) 2007 kuwata-lab.com all rights reserved.