Comments (6)
Hi,
Thanks for using this gem!
This gem should have no impact on how your records are saved. It has no dependency on external environment such as Rails, databases etc... It simply calls a block, the expectation, a number of times and each time it executes the block it measures the time. Therefore, the implication is that if you setup your DB once before the expectation is executed, and your foo.bar
code has side effects including modifications to DB, then it is no surprise that it fails to execute correctly on the second block evaluation.
The rspec matchers perform no mutation of your database as they have no understanding of any of your code. This gem can be used in any context to execute a function. If the function is pure then you don't need to worry, however in your case you have clear DB mutations and hence keeping all the setup in the block is the only way to ensure that each block evaluation starts in the same state.
Hope this makes sense!
from rspec-benchmark.
I'm having a similar problem. Could it be because the benchmark-perf
gem runs the block to be timed in a sub process?
from rspec-benchmark.
@tjwallace It could be or it could not be, I don't know. Would you have time to code up a minimal example using active record and sqlite that replicates the problem you're having and open a new issue? I would like to have something to poke around and I'm sure we can get to the bottom of it.
from rspec-benchmark.
@piotrmurach done, see issue #10
from rspec-benchmark.
@tjwallace Magic! Thank you.
from rspec-benchmark.
Thank you @tjwallace
from rspec-benchmark.
Related Issues (12)
- marshal data too short HOT 15
- Database empty while timing block HOT 4
- FloatDomainError HOT 9
- Implement a `perform_allocation_under` matcher HOT 3
- LocalJumpError: no block given (yield) HOT 1
- Failure message appears to contradict itself HOT 2
- some examples in Readme are failing HOT 1
- Compare performance to another operation HOT 9
- perform_under is run several times HOT 1
- .and_sample(n) does't work as expected HOT 6
- EOF end of file reached HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-benchmark.