-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
performancePerformance and optimizationPerformance and optimization
Description
When the tests are completed, zio-test outputs their results to the file "target/test-reports-zio/output.json". For output, zio.test.results.ResultFileOps.Json is used, which is implemented inefficiently:
- The implementation of the
writemethod opens and closes the file on each call. So, the file is reopened as many times as there were events. - Before writing the trailing block to the file, the trailing comma is removed from the file contents.
- To do this, the whole file is loaded into RAM.
- The same
writemethod is used to write each line of the file. Thus, the number of times a file is reopened increases by the number of lines in it.
Opening a file can be very expensive in some environments. I think all this could be implemented so that the file is opened and closed only once. I see two potential approaches:
- Open the file when
ResultFileOps.Jsonis initialized and close it after all events have been written. To eliminate the need to remove the trailing comma, the comma should be written not after every event, but before every event except the first one. - If it is acceptable to store the entire file contents in RAM, then the file can be created after all the JSON data has been generated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
performancePerformance and optimizationPerformance and optimization