Skip to content

Commit

Permalink
update benches to do less work during the action
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaldrip committed Oct 17, 2013
1 parent 129f76e commit 338eea4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions spec/benchmark/benchmark.rb
Expand Up @@ -100,9 +100,7 @@ def clear!
## Creates

# Benchmark Create
benchmark_average(n, '.create', before_each: -> { gather_attributes! }, after_all: -> { clear! }) do
Foo.create $attributes
end
benchmark_average(n, '.create', before_each: -> { gather_attributes! }, after_all: -> { clear! }) { Foo.create $attributes }

## Reads

Expand All @@ -122,9 +120,9 @@ def clear!
## Updates

# Benchmark Update
benchmark_average(n, '.update', before_each: -> { create_record! }, after_all: -> { clear! }) { Foo.sample.save }
benchmark_average(n, '.update', before_each: -> { $record = create_record! }, after_all: -> { clear! }) { $record.save }

## Deletes

# Benchmark Delete
benchmark_average(n, '.delete', before_each: -> { 2.times { create_record! } }, after_all: -> { clear! }) { Foo.sample.delete }
benchmark_average(n, '.delete', before_each: -> { 2.times { create_record! } ; $record = Foo.sample }, after_all: -> { clear! }) { $record.delete }

0 comments on commit 338eea4

Please sign in to comment.