From 548d7c842a14d6efc70dac6f247fb389752efa48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Anic=CC=81?= Date: Wed, 7 Feb 2024 21:16:44 +0100 Subject: [PATCH] add note about memory usage --- readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/readme.md b/readme.md index 68fd10f..7b6a007 100644 --- a/readme.md +++ b/readme.md @@ -84,6 +84,16 @@ Running same benchmarks on x86_64 GNU/Linux (Intel(R) Core(TM) i7-3520M CPU @ 2. | large.tar.gz | 11162624 | 65.68 | 99.80 | 1.52 | | cantrbry.tar.gz | 2821120 | 17.69 | 26.85 | 1.52 | +## Memory usage + +This library uses static allocations for all structures, doesn't require allocator. That makes sense especially for deflate where all structures, internal buffers are allocated to the full size. Little less for inflate where we std version uses less memory by not preallocating to theoretical max size array which are usually not fully used. + +For deflate this library allocates 395K while std 779K. +For inflate this library allocates 195K while std usually around 36K. + +Inflate difference is because we here use 64K history instead of 32K, and main reason because in huffman_decoder.zig we use lookup of 32K places for 286 or 30 symbols! + + ## References Great materials for understanding deflate: