PySmaz is a pure python port of the SMAZ small string compression library originally developed by Salvatore Sanfilippo. I thought I’d just jot down a few notes about the experience of porting the library from C to Python. In particular the challenges around optimizing both the absolute compression ratio of the algorithm, ensuring throughput is acceptable for its intended use, while preventing the code from descending into an unreadable mess.