Don't load the whole measurement file into memory at once -- it may be very large #38
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This change is to scan the measurement files line-by-line, rather than loading the whole thing into memory as a giant string.
With a large test suite, the measurement files can get rather large (30MB for half of our suite).
If we change the "invoked" numbers to be
\ndelimited instead of;delimited, then we can use the standard line-by-line buffered file reading libs to read in the statement ids instead of needing to read a huge string then doing a (memory-expensive)splitinto a huge array.Note that this creates a binary incompatibility -- you will need to recompile
sbt-scoverage(no source changes are needed in that project).This takes my test run (sbt scoverage:test, without a "clean") from 1m28 to 1m22. This number may overstate the improvement (or hopefully understate it); I haven't done very many tests.
Performance measurements digression
Just for interest, while I'm measuring performance, here are some numbers from our fairly large multi-threaded test suite (477 tests). Note that this is just the "test" part, not the integration test part. This is on my Windows dev machine, using Java 6 and Scala 2.10.3
Time to run "
sbt scoverage:test" without a clean (i.e. after a previous run has done all the compilation):I don't quite believe this, but I have just checked and re-checked this, and it seems like "
sbt test" takes longer than "sbt scoverage:test", at about 2m06. I'm going to have to dig into that!(The variance of each of the measured numbers above looks to be around 5%)