Skip to content

Commit

Permalink
A few more perf script changes based on recent TS updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Mar 14, 2012
1 parent d3b70e1 commit 58abfd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 5 additions & 6 deletions perf/reads.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@

class User
include Toy::Store
adapter(:memory, {})
attribute :name, String
end

user = User.create(:name => 'John')
id = user.id
times = 10_000

client_result = Benchmark.realtime {
adapter_result = Benchmark.realtime {
times.times { User.adapter.decode(User.adapter.client[User.adapter.key_for(id)]) }
}

adapter_result = Benchmark.realtime {
toystore_result = Benchmark.realtime {
times.times { User.get(id) }
}

puts 'Client', client_result
puts 'Toystore', adapter_result
puts 'Ratio', adapter_result / client_result
puts 'Client', adapter_result
puts 'Toystore', toystore_result
puts 'Ratio', toystore_result / adapter_result

# PerfTools::CpuProfiler.start('prof_client') do
# times.times{ User.adapter.decode(User.adapter.client[User.adapter.key_for(id)]) }
Expand Down
1 change: 0 additions & 1 deletion perf/writes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

class User
include Toy::Store
adapter(:memory, {})
end

times = 10_000
Expand Down

0 comments on commit 58abfd5

Please sign in to comment.