Skip to content

Commit

Permalink
[benchmark] crlf constant vs string benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Nov 29, 2010
1 parent 899e6ef commit c304aeb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions benchmarks/concat_vs_insert.rb
@@ -1,7 +1,7 @@
require 'rubygems'
require 'tach'

Tach.meter(1_000) do
Tach.meter(1_000_000) do
tach('concat') do
path = 'path'
path = '/' << path
Expand All @@ -15,7 +15,7 @@
# +--------+----------+
# | tach | total |
# +--------+----------+
# | concat | 0.000797 |
# | insert | 0.974036 |
# +--------+----------+
# | insert | 0.000871 |
# | concat | 0.998904 |
# +--------+----------+
21 changes: 21 additions & 0 deletions benchmarks/crlf.rb
@@ -0,0 +1,21 @@
require 'rubygems'
require 'tach'

CRLF = "\r\n"

Tach.meter(1_000_000) do
tach('constant') do
'' << CRLF
end
tach('string') do
'' << "\r\n"
end
end

# +----------+----------+
# | tach | total |
# +----------+----------+
# | constant | 0.813338 |
# +----------+----------+
# | string | 0.900186 |
# +----------+----------+

0 comments on commit c304aeb

Please sign in to comment.