Fast Static Symbol Tables compression for Elixir with an optional Rustler backend https://hex.pm/packages/fsst
  • Elixir 96.4%
  • Rust 3.6%
Find a file
2026-06-11 12:34:13 +03:00
.github/workflows Use shared Rustler release workflow 2026-06-07 01:30:02 +03:00
bench Initial FSST implementation 2026-05-26 19:27:08 +03:00
lib Remove duplicated candidate scoring 2026-06-07 00:33:47 +03:00
native/fsst_nif Initial FSST implementation 2026-05-26 19:27:08 +03:00
test Use precompiled Rustler NIF 2026-05-26 19:37:23 +03:00
.credo.exs Initial FSST implementation 2026-05-26 19:27:08 +03:00
.formatter.exs Initial FSST implementation 2026-05-26 19:27:08 +03:00
.gitignore Initial FSST implementation 2026-05-26 19:27:08 +03:00
.reach.exs Initial FSST implementation 2026-05-26 19:27:08 +03:00
.tool-versions Use Elixir 1.20 by default 2026-06-06 16:59:39 +03:00
AGENTS.md Use shared Rustler CI workflow 2026-06-07 00:19:58 +03:00
checksum-Elixir.FSST.Native.exs Update precompiled NIF checksums for v0.1.2 2026-05-26 19:45:30 +03:00
LICENSE Initial FSST implementation 2026-05-26 19:27:08 +03:00
mix.exs Release v0.1.2 2026-05-26 19:42:50 +03:00
mix.lock Use precompiled Rustler NIF 2026-05-26 19:37:23 +03:00
README.md README: ecosystem footer linking org and Building Blocks standard 2026-06-11 12:34:13 +03:00

FSST

Fast Static Symbol Tables compression for Elixir.

FSST is a string compression algorithm designed for database-style workloads: many short strings compressed with a shared static symbol table. This package provides a pure Elixir implementation and an optional Rustler backend powered by fsst-rs.

Installation

def deps do
  [
    {:fsst, "~> 0.1.0"}
  ]
end

Usage

table = FSST.train!(["hello", "hello world", "hello there"])
compressed = FSST.compress!(table, "hello world")
"hello world" = FSST.decompress!(table, compressed)

Prefer the non-bang functions when handling user input:

with {:ok, table} <- FSST.train(samples),
     {:ok, compressed} <- FSST.compress(table, input),
     {:ok, decompressed} <- FSST.decompress(table, compressed) do
  {:ok, decompressed, compressed}
end

Existing symbol tables

Some formats store a pre-trained FSST dictionary separately from compressed payloads. Build a table directly from symbols in code order:

table = FSST.Table.from_symbols!(["hello", " world"])
"hello world!" = FSST.decompress!(table, <<0, 1, 255, ?!>>)

Backends

  • FSST.Pure is always available and contains the Elixir implementation.
  • FSST.Rust wraps fsst-rs through Rustler when the NIF is available.
  • FSST.backend/1 uses :auto by default, preferring Rust when available and otherwise falling back to pure Elixir.

Select a backend explicitly:

table = FSST.train!(samples, backend: :pure)
table = FSST.train!(samples, backend: :rust)

Training options

Pure training accepts tuning options:

FSST.train!(samples, max_symbol_size: 8, sample_bytes: 65_536)
  • :max_symbol_size controls candidate symbol length.
  • :sample_bytes limits training input for large corpora. Use :infinity to train on all provided bytes.

Benchmarks

mix run bench/fsst_bench.exs

Part of Elixir Vibe

FSST brings fast static symbol-table string compression to Elixir.

It is one building block of a larger stack — tools that make AI-generated software checkable: structural search, dependence analysis, duplication and slop detection, session replay, and ecosystem-wide code search. See the Elixir Vibe organization for the rest, and Building Blocks for the Future Web for the thesis, architecture, and roadmap that tie them together.

License

MIT © 2026 Danila Poyarkov