HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
gtoubassi
femtozip
Shell2015–2020
gtoubassi / femtozip

femtozip

FemtoZip is a "shared dictionary" compression library optimized for small documents that may not compress well with traditional tools such as gzip

2Distinct people
2Mentions
0Explicit recommenders
148GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

FemtoZip is a "shared dictionary" compression library optimized for small documents that may not compress well with traditional tools such as gzip

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year2 dated mentions

Observed mentions: 2015-03-30 16:30:19 UTC to 2020-05-05 09:34:24 UTC.

012015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101

What Hacker News says

2 sources
> Finding ways to have, say, 10 million blacklist elements with a small memory footprint is left as an exercise for the reader. In case the reader is interested (and this may not be what OP had in mind): In trading memory gains with computation, this is how I squeezed ~4M entries in less than 30 MiB: 1. Compress (reversed) individual entries using a dictionary or entropy encoder. I experimented with Shoco [0], Femto [1], and a modified LZ78 [2]. 2. Create a bloom filter for membership checks, [3] or any probabilistic structure for that matter, like the xor-filters [4]. This prevents expensive but unnecessary lookups. 3. Insert the compressed (reversed: google.com -> com.google) entries into a radix-tree [5]. You could use a directed-acyclic graph (DAG), if you don't need to store key-value pairs. 4. Compact [6][7] the radix-tree [8] (comp
Read the rest
acting a DAG might be super complicated). 5. On every search: 5a. Compress (reversed) incoming query (i.e. domain-name). 5b. Check the bloom filter. 5c. Traverse the radix-tree, if necessary. 5d. Cache an eligible entry in a LFU [9] or possibly, using any other suitable algorithm inspired from Linux's page replacement implementations [10]. 6. Strive for zero-allocation and zero-gc. --- [0] https://news.ycombinator.com/item?id=10060018 [1] https://github.com/gtoubassi/femtozip/wiki/How-femtozip-work... [2] https://en.wikipedia.org/wiki/LZ78 [3] https://news.ycombinator.com/item?id=12231623 [4] https://news.ycombinator.com/item?id=21840821 [5] https://vincent.bernat.ch/en/blog/2017-ipv4-route-lookup-lin... [6] https://news.ycombinator.com/item?id=22544718 [7] https://www.youtube-nocookie.com/embed/3Y2weLDiUWw [8] https://news.ycombinator.com/item?id=2348619 [9] https://github.com/ronomon/hash-table/blob/master/README.md [10] https://en.wikipedia.org/wiki/Page_replacement_algorithm
In Ad blocking with Raspberry Pi and Pi-hole
Annoying detail for DEFLATE + dictionary is that the dictionary has to be provided within every reader (setDictionary in java). The output from the DEFLATE stream is not standalone, which makes it really hard to use - a more ideal approach would've been to provide training to the Huffman tree & guess best window sizing from a sample. But SDCH solves that problem by storing an external named dictionary - clients will read it off a common HTTP location if it's missing in the cache. Within that, there's a pretty neat standard which SDCH uses - RFC 3284. I ran into it trying to optimize holding a few billion serialized blogs within an in-memory store with transactional updates - the issue was mostly the in-memory sizes of serialized objects. I ended up using a versioned external dictionary for compression, which was an extension to VCDIFF wit
Read the rest
h 1 additional instruction in its streams - COPY_DICT. That concept can be pushed further, to get to something more generic like femtozip - https://github.com/gtoubassi/femtozip/wiki/How-femtozip-work...
In Improving compression with a preset DEFLATE dictionary

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.