Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compression option for WPILOGs #6834

Open
jwbonner opened this issue Jul 14, 2024 · 3 comments
Open

Add compression option for WPILOGs #6834

jwbonner opened this issue Jul 14, 2024 · 3 comments
Labels
component: wpiutil WPI utility library

Comments

@jwbonner
Copy link
Member

Many teams are using the WPILOG format to store hundreds or thousands of fields, and often without removing duplicate values. This can result in enormous log files that are difficult to download and can quickly fill the RIO's storage. Adding an option to compress data before writing to disk would alleviate this issue, and could remain optional by adding a compression flag to the WPILOG header.

Of course, choosing an algorithm and configuration that can perform well on the RIO is an important consideration. However, we already have evidence that this is reasonable given CTRE's (apparent) use of compression for the Hoot log format without issue.

I ran a couple of tests using zlib (with the same configuration as gzip) to determine how effective compression might be on a typical WPILOG. This is based on a ~4.5 minute log file of a real match with 533 fields, including a variety of data types (arrays, structs, simple values, etc).

  • Without duplicate values: 23.3 MB compresses to 11.5 MB (49.4%)
  • Including duplicate values: 178.1 MB compresses to 31.7 MB (17.8%)
@auscompgeek auscompgeek added the component: wpiutil WPI utility library label Jul 14, 2024
@PeterJohnson
Copy link
Member

PeterJohnson commented Jul 15, 2024

Some options for compression could be zstd or LZ4. zstd seems to work better on 64-bit, and LZ4 seems to be lower overhead, although zlib with Z_BEST_SPEED seems to be very fast? Need to do some benchmarks on the Rio.

Would it be better to use a different file extension than .wpilog for compressed files?

@jwbonner
Copy link
Member Author

I would tend towards keeping the wpilog extension, which would align with how MCAP handles compression (the algorithm used to encode each chunk is part of the header). The main benefit I can think of for using a different extension is that it increases visibility for users who might want to turn it off. But assuming that the performance tradeoff is reasonable, I think most users shouldn't need to worry about whether compression is enabled. I could see adding some text to AdvantageScope displaying whether or not the log is compressed though, so users who are interested could check it there.

@Daniel1464
Copy link
Contributor

This would also be pretty helpful if you're using a rio 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpiutil WPI utility library
Projects
None yet
Development

No branches or pull requests

4 participants