- Open Source Project: https://github.com/devhub-tools/devhub
- LiveSync: https://github.com/devhub-tools/live_sync
- DataTable lit webcomponent: https://github.com/devhub-tools/devhub/blob/7eb2a852ec0134f7b226f4be2aec73a628b6b387/assets/js/components/data-table.ts
- DataTable hook: https://github.com/devhub-tools/devhub/blob/7eb2a852ec0134f7b226f4be2aec73a628b6b387/assets/js/hooks/data-table.js
- Lit: https://lit.dev
- Lit virtualizer: https://www.npmjs.com/package/@lit-labs/virtualizer
- LiveView 1.1: https://hexdocs.pm/phoenix_live_view/changelog.html#change-tracking-in-comprehensions
Last active
August 18, 2025 13:28
-
-
Save michaelst/12f66333dd053e93a243ba9bcc1d59eb to your computer and use it in GitHub Desktop.
ElixirConf 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
:benchee, | |
{:brotli, github: "tellerhq/erl-brotli", branch: "master", override: true}, | |
]) | |
payload = File.read!("small.json") | |
IO.inspect(byte_size(payload), label: "payload size") | |
:brotli.encode(payload, %{quality: 5}) |> elem(1) |> byte_size() |> IO.inspect(label: "brotli") | |
IO.inspect(byte_size(:zlib.gzip(payload)), label: "gzip") | |
Benchee.run( | |
%{ | |
"brotli" => fn -> :brotli.encode(payload, %{quality: 5}) end, | |
"gzip" => fn -> :zlib.gzip(payload) end, | |
}, | |
time: 10, | |
memory_time: 2 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload size: 797920 | |
brotli: 20160 | |
gzip: 139151 | |
Operating System: macOS | |
CPU Information: Apple M1 Max | |
Number of Available Cores: 10 | |
Available memory: 64 GB | |
Elixir 1.18.4 | |
Erlang 28.0.2 | |
JIT enabled: true | |
Benchmark suite executing with the following configuration: | |
warmup: 2 s | |
time: 10 s | |
memory time: 2 s | |
reduction time: 0 ns | |
parallel: 1 | |
inputs: none specified | |
Estimated total run time: 28 s | |
Benchmarking brotli ... | |
Benchmarking gzip ... | |
Calculating statistics... | |
Formatting results... | |
Name ips average deviation median 99th % | |
brotli 496.03 2.02 ms ±7.21% 1.99 ms 2.35 ms | |
gzip 50.93 19.63 ms ±2.17% 19.55 ms 20.61 ms | |
Comparison: | |
brotli 496.03 | |
gzip 50.93 - 9.74x slower +17.62 ms | |
Memory usage statistics: | |
Name Memory usage | |
brotli 0.50 KB | |
gzip 4.68 KB - 9.36x memory usage +4.18 KB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload size: 15408 | |
brotli: 3092 | |
gzip: 3280 | |
Operating System: macOS | |
CPU Information: Apple M1 Max | |
Number of Available Cores: 10 | |
Available memory: 64 GB | |
Elixir 1.18.4 | |
Erlang 28.0.2 | |
JIT enabled: true | |
Benchmark suite executing with the following configuration: | |
warmup: 2 s | |
time: 10 s | |
memory time: 2 s | |
reduction time: 0 ns | |
parallel: 1 | |
inputs: none specified | |
Estimated total run time: 28 s | |
Benchmarking brotli ... | |
Benchmarking gzip ... | |
Calculating statistics... | |
Formatting results... | |
Name ips average deviation median 99th % | |
gzip 7.07 K 141.51 μs ±17.59% 137.17 μs 241.11 μs | |
brotli 4.48 K 223.31 μs ±50.49% 215.63 μs 800.43 μs | |
Comparison: | |
gzip 7.07 K | |
brotli 4.48 K - 1.58x slower +81.80 μs | |
Memory usage statistics: | |
Name Memory usage | |
gzip 376 B | |
brotli 512 B - 1.36x memory usage +136 B |
sequenceDiagram
actor User
participant CodeMirror webcomponent
participant DataTable webcomponent
participant LiveView
participant Repo.stream task
User->>CodeMirror webcomponent: type query into editor
User->>LiveView: click run query button
LiveView->>CodeMirror webcomponent: push_event to get query
CodeMirror webcomponent->>LiveView: send query
LiveView->>Repo.stream task: start task and run Repo.stream
Repo.stream task->>LiveView: send data chunk
LiveView->>DataTable webcomponent: push_event to send data chunk to browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload size: 4646 | |
brotli: 1305 | |
gzip: 1425 | |
Operating System: macOS | |
CPU Information: Apple M1 Max | |
Number of Available Cores: 10 | |
Available memory: 64 GB | |
Elixir 1.18.4 | |
Erlang 28.0.2 | |
JIT enabled: true | |
Benchmark suite executing with the following configuration: | |
warmup: 2 s | |
time: 10 s | |
memory time: 2 s | |
reduction time: 0 ns | |
parallel: 1 | |
inputs: none specified | |
Estimated total run time: 28 s | |
Benchmarking brotli ... | |
Benchmarking gzip ... | |
Calculating statistics... | |
Formatting results... | |
Name ips average deviation median 99th % | |
gzip 33.96 K 29.45 μs ±23.27% 28.58 μs 44.46 μs | |
brotli 6.71 K 149.11 μs ±122.14% 136.50 μs 439.78 μs | |
Comparison: | |
gzip 33.96 K | |
brotli 6.71 K - 5.06x slower +119.66 μs | |
Memory usage statistics: | |
Name Memory usage | |
gzip 200 B | |
brotli 512 B - 2.56x memory usage +312 B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment