Docsity

Optimizing Zlib on Arm: Enhancing Web Browser Performance with NEON, Lecture notes of Benchmarking

Partial preview of the text

Download Optimizing Zlib on Arm: Enhancing Web Browser Performance with NEON and more Lecture notes Benchmarking in PDF only on Docsity!

Optimizing Zlib on Arm:

The power of NEON

Adenilson Cavalcanti ARM - San Jose (California)

@adenilsonc

Why zlib?

Zlib Used everywhere (libpng, Skia, freetype, cronet , Firefox, Chrome, linux kernel, android, iOS, JDK, git, etc). Old code base released in 1995. Written in K&R C style.

Context Lacks any optimizations for ARM CPUs.

Problem statement Identify potential optimization candidates and verify positive effects in Chromium.

โ— Performed some benchmarking. โ— Contacted each project. โ— Mixed results (1 project never replied back).

Before deepening the fork...

โ— Performed some benchmarking. โ— Contacted each project. โ— Mixed results (1 project never replied back).

None focused on decompression* or had ARM specific optimizations.

Before forking...

*Important for a Web Browser.

Parrots are not created equal

Original: 2.7MB

Palette: 0.8MB

Zopfli: 2.6MB

Perf to the rescue

โ— Optional on ARMv7. โ— Mandatory on ARMv8.

NEON

Registers

ARMv โ— 16 registers@128 bits: Q

  • Q15. โ— 32 registers@64bits: D0 - D31. โ— Varied set of instructions: load, store, add, mul, etc.

ARMv โ— 32 registers@128 bits: Q0 - Q31. โ— 32 registers@64bits: D0 - D31. โ— 32 registers@32bits: S0 - S31. โ— 32 registers@8bits: H0 - H31. โ— Varied set of instructions: load, store, add, mul, etc.

Entropy & Compression

Entertaining definition

https://www.youtube.com/watch?v=l49MHwooaVQ

Practical explanation

a) HTML b) JPEG

Practical visualization

./binwalk -E filea) HTML: 0.68 b) JPEG: 0.

Adler-32 checksum

https://en.wikipedia.org/wiki/Adler-

Adler-32 simplistic implementation

https://en.wikipedia.org/wiki/Adler-