Rethinking Compression for Apple Silicon
Modern hardware changes the cost of old algorithms.

Compression is a mixture of memory access, branches, arithmetic and data dependencies. A faster processor reaches each of those limits at a different point. Apple Silicon makes that relationship especially visible.
Imagine profiling two compressors on the same Mac. One spends much of its time following candidate matches around a large dictionary. The other uses a small table, yet has to finish updating its coding state before it can process the next symbol. A change that helps the first can leave the second where it was. You can put numbers on those differences only after looking at what each codec spends its time doing.
Where the time goes
A match finder that jumps through a large dictionary may spend its time waiting for individual loads. A sequential scan can stress memory in a different way, by sustaining enough traffic to approach the bandwidth available to it. Unified memory lets processors share memory and still leaves that bandwidth finite. A codec can also spend its time on work that stays entirely in cache, such as a state update whose next step depends on the previous one (Figure 1). [1]
Fig. 01
Three ways to spend a cycle.
Open a hypothesis to see what evidence would support it.
Compute and dependencies
Check how much sampled time falls in byte comparison, transforms or entropy coding. Inspect the hot loop for independent work. A serial coding-state update can limit throughput even when the data stays close to the core.
Cache and locality
Sweep the working-set size and profile the lookup path. A slowdown alongside more costly loads supports a locality hypothesis. Track compressed size too, since changing the dictionary can change the output.
Memory bandwidth
Add workers on independent blocks and check whether the aggregate data rate levels off as memory traffic rises. Compare with a smaller working set, and rule out scheduling, synchronization and I/O before assigning the cause.
Comparing bytes with SIMD
Once a match finder has a candidate, it can compare consecutive bytes from the input and the candidate in groups. Arm’s Advanced SIMD extension, Neon, can compare two 16-byte vectors at once. The codec still has to find the first unequal byte and handle any tail that falls outside a full vector. Suitable checksum implementations can also use SIMD or dedicated instructions, depending on the algorithm and hardware. [2]
The cost of finding the candidate remains. If most matches break after two bytes, early exit can be valuable. If most have long common prefixes and the data is ready to load, a vector comparison may save work. Those are reasons to look at the distribution of match lengths on your corpus (Figure 2).
Fig. 02 / Interactive
Where does the first mismatch land?
- Input
- Candidate
With a mismatch at byte 12, a one-byte-at-a-time loop reaches it after 12 comparisons. A vector comparison checks all 16 byte lanes together and gives a result from which the codec can find the first mismatch.
When more workers help
Independent blocks can be compressed concurrently. Some codecs share history across blocks, so changing block boundaries can also change compression ratio or the format of the output. Workers bring coordination costs and compete for memory resources. Small inputs can finish before those costs are worth paying (Figure 3).
Fig. 03 / Interactive
How much of the work can overlap?
A one-worker run starts at 100 work units. This model divides the parallel portion among effective workers, keeps the serial portion fixed, and adds 3 units for each extra worker.
1 worker
4 workers
With 20 serial units and 80 parallel units, four workers take 49 modeled units, coordination included. If the parallel portion stops speeding up after three workers, adding more only adds overhead in this model.
Actual Apple Silicon systems complicate a worker sweep. Performance and efficiency cores can finish the same amount of work at different rates. macOS schedules work with factors including its quality-of-service class and the system’s activity. Sustained runs may also behave differently from short bursts as temperature and power conditions change. Record the machine, run conditions, and scheduling settings alongside each result. [3]
How to investigate it
Start with one codec version and one native arm64 build configuration. Decide whether the experiment measures codec work from resident buffers or an end-to-end command that includes file I/O. Both are meaningful, and they answer different questions.
- Pin the implementation. Record the codec revision, toolchain, build flags, compression level, and block and dictionary settings. Compare the scalar and supported vector paths with the same inputs. Confirm which path actually ran, especially if the compiler can auto-vectorize the scalar build.
- Fix the corpus and sweep one factor at a time. Keep a manifest with input sizes and hashes. Include small and large files with different compressibility. Sweep worker counts while holding codec settings fixed. If the implementation changes framing with worker count, record that separately.
- Repeat and record the machine state. Record the Mac model and chip, macOS version, power mode, thermal conditions, and background load. Define the warm-up and repeat policy. Alternate configurations so that heating or drift is less likely to favor one build.
- Measure time, cost, and output. Save wall time, CPU time, peak memory, compressed size, and any available energy telemetry with its measurement scope. Report throughput using uncompressed bytes per second, and separate encode and decode. Keep individual runs so variations remain visible.
- Verify correctness before comparing speed. Decode each output and check it against the input. Where identical encoded output is a requirement, verify that separately. A valid round trip can coexist with a different compressed byte stream or a different ratio.
This is a proposed experiment. A reproducible report would include the manifest, software versions, configuration, raw observations, and verification criteria. The figures use conceptual examples.
What this means
If profiles point to match extension, try the vector path. If they point to dictionary access, test a more local layout and watch what happens to compressed size. If adding workers moves the bottleneck to memory or coordination, find the worker count that serves the actual workload. The same codec can lead you to a different choice on a different corpus.
Architecture-aware optimization starts with finding what the codec waits for.
References and further reading
- Apple Developer. Apple Silicon CPU Optimization Guide.
- Arm. Arm Neon.
- Apple Developer. Tuning your code’s performance for Apple silicon.
- Apple Developer. Apple silicon documentation.
- Apple Developer. Optimize CPU performance with Instruments (WWDC25).
