Feature request: Add Ruby 2.6 Oneshot ability
Released in Ruby 2.6.0 - Coverage has a OneShot ability which improves performance.
Instead of returning the volume of coverage, it simply returns a binary representation (0 or 1+).
This would be useful for people who want to check 100% code coverage but not volume of tests.
You could add a flag that only works for Ruby 2.6 users, or release it as a 1.0 version
Thoughts?
Refs: https://bugs.ruby-lang.org/issues/15022 / https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/
Hi there @luke-hill!
I'm not sure that this fits into simplecov but I'll ping @colszowka - for me the main goal of simplecov to deal with the coverage results and display them in a nice way. This oneshot needs none of that and you could just run it completely without simplecov as it basically bypasses anything simplecov does.
Besides that, the selling point of it is that it adds no overhead. In my experience the overhead of coverage/simplecov is extremely small. 3 seconds on a 15 minutes test suite small so I'm also not sure it's worth it from that perspective.
Ok, so I missunderstood one shot I thought it was just "all or nothing" but it's on a per line basis so that'd work and definitely has a place:
one shot line coverage is a type of coverage that only cares about whether a line of code was executed or not (which is mostly what we care about) - throwing away the counting makes the overhead less for CPU intensive tasks.
More can be found in the original ruby bug tracker: https://bugs.ruby-lang.org/issues/15022
this wouldn't be too bad to add, I added it to coverband fairly easily basically just need to ingest the new format, then transform to the existing simplecov expected format. I will say in test though, I really haven't noticed the overhead and the saving isn't that noticeable even on massive apps. Oneshot is far more useful for production runtime coverage.
As I understand it, it's useful for CPU intensive apps and not so noticable in IO heavy apps like web applications. So, I guess for one of these just "solving hardcore CS problems" things like a lot of the common ruby benchmarks.
Gotcha, OK, I do have a fairly Rails centric view of Ruby... OK, I will try to add this to my OSS todo backlog, I have a good mental model on how to add the support, but would need to find the time.
Yeah CPU intensive applications aren't exactly Ruby's stronghold :sweat_smile: