Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hf-api includes a function that computes a CRC32 of a chunk of data. Unfortunately, it made the (easy, common) mistake of allocating a crc::Crc on the stack. The upstream crc crate, despite our protests, optimizes for time over space. A crc::Crc includes a lookup table to accelerate the calculation of the CRC. Creating one at runtime on the stack means 1. The lookup table is on your stack (all 2048 bytes of it, in this case), and 2. Your function now contains code to generate the lookup table. This is a footgun in the crc API design, IMO. It's far too easy to make this mistake. Anyway, made it static for a 2 kiB improvement in stack margin.
- Loading branch information