Skip to content

Commit

Permalink
[benchmark] concat vs insert for path
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Nov 29, 2010
1 parent 146b531 commit 899e6ef
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions benchmarks/concat_vs_insert.rb
@@ -0,0 +1,21 @@
require 'rubygems'
require 'tach'

Tach.meter(1_000) do
tach('concat') do
path = 'path'
path = '/' << path
end
tach('insert') do
path = 'path'
path.insert(0, '/')
end
end

# +--------+----------+
# | tach | total |
# +--------+----------+
# | concat | 0.000797 |
# +--------+----------+
# | insert | 0.000871 |
# +--------+----------+

0 comments on commit 899e6ef

Please sign in to comment.