public
Description: Prettier Benchmarking for Ruby
Clone URL: git://github.com/wycats/benchwarmer.git
Improve README
wycats (author)
Sun May 04 11:11:08 -0700 2008
commit  f9a9f3525d3994b0317ec7ab1a2a8c2baebe3782
tree    56dda391dc5a194bdd8ee310834e1720b0361309
parent  b4465784e9f6b828fa48f1fb94a685b3c1c661b0
0
...
85
86
87
 
 
 
88
89
90
...
93
94
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
97
...
85
86
87
88
89
90
91
92
93
...
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
0
@@ -85,6 +85,9 @@
0
     end
0
   end
0
 
0
+ # Output:
0
+ # Running the benchmarks 100000 times each...
0
+ #
0
   # Results |
0
   # ---------------------------------
0
   # Squeezing with #squeeze 0.15 |
0
@@ -93,4 +96,23 @@
0
   # Spliting with #split 0.43 |
0
   # with #match 0.29 |
0
   # ---------------------------------
0
+
0
+ Benchmark.warmer(TIMES) do
0
+ report "squeezing with #squeeze" do
0
+ "abc//def//ghi//jkl".squeeze("/")
0
+ end
0
+ report "squeezing with #gsub" do
0
+ "abc//def//ghi//jkl".gsub(/\/+/, "/")
0
+ end
0
+ end
0
+
0
+ # Output:
0
+ # Running the benchmarks 100000 times each...
0
+ #
0
+ # Results |
0
+ # ----------------------------------
0
+ # squeezing with #squeeze 0.15 |
0
+ # squeezing with #gsub 0.34 |
0
+ # ----------------------------------
0
+
0
   
0
\ No newline at end of file

Comments

    No one has commented yet.