SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
PyCon mini JP 2011 Lightning Talk




Benchmarker
a good friend for performance



  makoto kuwata
  http://www.kuwata-lab.com/
Profile
 @makotokuwata

 http://www.kwuata-lab.com/
              Perl is the
 Ruby/PHP/Python programmer

          CHAMPION!
 Creator of Erubis (*)

 Python4PHPer


                (*) default template engine on Rails 3
Question
Which is faster?
  	       	 
 	  	  	  	  	  	  	  	  	  	 

  	 
 	  	                  	  	        	     	    	    	 

  	 
 	  	                 	     	     	     	 
                           https://gist.github.com/800384
Benchmark
                                   '+' op is the fastest
                                   for short strings


plus op             0.624sec


 format                            0.887sec


   join                   0.709sec

          0   0.2   0.4      0.6       0.8      1

                           second per million
Which is faster?
    	       	 
   	  	 
      	  	  	 
 	 	  	  	 

    	     	      	 
   	  	 
      	  	  	 
 	 	  	  	  	  	 
                      https://gist.github.com/801429
Benchmark
                                              Not Same!



'+=' op                         0.431sec




'=' & '+'                          0.439sec


            0   0.1   0.2    0.3       0.4       0.5

                            second per million
Which is faster?
    	       	 
   	  	 
      	  	  	 
 	 	  	  	  	  	 

    	     	      	 
   	  	 
      	  	  	 
 	 	  	  	  	  	  	  	 
                          https://gist.github.com/801429
Benchmark

   '+=' op        0.545sec




'=' and '+'       Too Slow! Unmeasurable!


              0       0.4    0.8    1.2     1.6         2

                                   second per million
Why?
[OT] Python v.s. Perl
[OT] Python v.s. Perl
     	             	 
 	 	 	 	 	 	 	 	 	 	 	 	  	  	 	  	  	 	  	  	 	  	  	 
             	  	  	 	 	 	  	 	 	 	  	 	 	 	  	 	 	 	 

     	        	 
                     Perl is
 	 	 	 	  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
 	 	 	 	 	  	  	  	  	  	  	  	  	  	  	 

                   AWESOME!
About Benchmarker
Benchmarker
 Benchmarking utility for Python
 A good friend for performance
 http://pypi.python.org/pypi/Benchmarker/
Example Code
Output
Remove same fot-stmt
Repeat all benchmarks
     	 
          	                                                 	    	 
 	 	  	            	  	 
 	 	       	  	  	 
 	 	 	 	        	                  	 
 	 	 	 	 	 	 
                                                Remove min & max results
Command-line Options
thank you

Mais conteúdo relacionado

Destaque (6)

Presentacion Benchmarking
Presentacion BenchmarkingPresentacion Benchmarking
Presentacion Benchmarking
 
Benchmarking
BenchmarkingBenchmarking
Benchmarking
 
Benchmarking ppt
Benchmarking pptBenchmarking ppt
Benchmarking ppt
 
Decision Making Process
Decision Making ProcessDecision Making Process
Decision Making Process
 
Benchmarking
BenchmarkingBenchmarking
Benchmarking
 
Benchmarking
BenchmarkingBenchmarking
Benchmarking
 

Semelhante a Benchmarker - A Good Friend for Performance

Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
Best of Breed OpenStack Compute & Block Storage Cloud... .pdfBest of Breed OpenStack Compute & Block Storage Cloud... .pdf
Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
OpenStack Foundation
 
Using Node.js to improve the performance of Mobile apps and Mobile web
Using Node.js to improve  the performance of  Mobile apps and Mobile webUsing Node.js to improve  the performance of  Mobile apps and Mobile web
Using Node.js to improve the performance of Mobile apps and Mobile web
Tom Croucher
 
Cisco career certification paths
Cisco career certification pathsCisco career certification paths
Cisco career certification paths
Sathishkumar A
 
[A3]deview 2012 network binder
[A3]deview 2012 network binder[A3]deview 2012 network binder
[A3]deview 2012 network binder
NAVER D2
 
Connections and Ports in ESX / ESXi
Connections and Ports in ESX / ESXi Connections and Ports in ESX / ESXi
Connections and Ports in ESX / ESXi
Dudley Smith
 
[D1]deview 2012 nvidia
[D1]deview 2012 nvidia[D1]deview 2012 nvidia
[D1]deview 2012 nvidia
NAVER D2
 
Hive at Last.fm
Hive at Last.fmHive at Last.fm
Hive at Last.fm
huguk
 

Semelhante a Benchmarker - A Good Friend for Performance (20)

Cinefilia Demo - EGEE User Forum 2009
Cinefilia Demo - EGEE User Forum 2009Cinefilia Demo - EGEE User Forum 2009
Cinefilia Demo - EGEE User Forum 2009
 
Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
Best of Breed OpenStack Compute & Block Storage Cloud... .pdfBest of Breed OpenStack Compute & Block Storage Cloud... .pdf
Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
 
Using Node.js to improve the performance of Mobile apps and Mobile web
Using Node.js to improve  the performance of  Mobile apps and Mobile webUsing Node.js to improve  the performance of  Mobile apps and Mobile web
Using Node.js to improve the performance of Mobile apps and Mobile web
 
Living Company vol.1 Review
Living Company vol.1 ReviewLiving Company vol.1 Review
Living Company vol.1 Review
 
Poster EWEA "Damping Estimation of an Offshore Wind Turbine on a Monopile Fou...
Poster EWEA "Damping Estimation of an Offshore Wind Turbine on a Monopile Fou...Poster EWEA "Damping Estimation of an Offshore Wind Turbine on a Monopile Fou...
Poster EWEA "Damping Estimation of an Offshore Wind Turbine on a Monopile Fou...
 
HTML5 on mobile
HTML5 on mobileHTML5 on mobile
HTML5 on mobile
 
Primitives And Design Patterns for Top-Down SOA Implementations
Primitives And Design Patterns for Top-Down SOA ImplementationsPrimitives And Design Patterns for Top-Down SOA Implementations
Primitives And Design Patterns for Top-Down SOA Implementations
 
Web Technologies
Web TechnologiesWeb Technologies
Web Technologies
 
Cisco career certification paths
Cisco career certification pathsCisco career certification paths
Cisco career certification paths
 
HTML5 for Designers (HTML5 時代の Web デザイナーの新常識)
HTML5 for Designers (HTML5 時代の Web デザイナーの新常識)HTML5 for Designers (HTML5 時代の Web デザイナーの新常識)
HTML5 for Designers (HTML5 時代の Web デザイナーの新常識)
 
[A3]deview 2012 network binder
[A3]deview 2012 network binder[A3]deview 2012 network binder
[A3]deview 2012 network binder
 
Connections and Ports in ESX / ESXi
Connections and Ports in ESX / ESXi Connections and Ports in ESX / ESXi
Connections and Ports in ESX / ESXi
 
REST: putting the web back in to web services
REST: putting the web back in to web servicesREST: putting the web back in to web services
REST: putting the web back in to web services
 
[D1]deview 2012 nvidia
[D1]deview 2012 nvidia[D1]deview 2012 nvidia
[D1]deview 2012 nvidia
 
080811
080811080811
080811
 
Viedome Presentation Eu
Viedome Presentation EuViedome Presentation Eu
Viedome Presentation Eu
 
Hive at Last.fm
Hive at Last.fmHive at Last.fm
Hive at Last.fm
 
Teaching Computational Thinking Through Scratch Programming 2
Teaching Computational Thinking Through Scratch Programming 2Teaching Computational Thinking Through Scratch Programming 2
Teaching Computational Thinking Through Scratch Programming 2
 
Agile in Practice
Agile in PracticeAgile in Practice
Agile in Practice
 
Bitocast - A hybrid BitTorrent and IP Multicast content distribution solution
Bitocast - A hybrid BitTorrent and IP Multicast content distribution solutionBitocast - A hybrid BitTorrent and IP Multicast content distribution solution
Bitocast - A hybrid BitTorrent and IP Multicast content distribution solution
 

Mais de 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
 

Mais 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マッパーが重要か?
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Python
 
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"
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラム
 
Javaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンJavaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジン
 

Benchmarker - A Good Friend for Performance