From 052ecdb0d7198c65a93ae8945ce08f67378ad6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= <~@hauleth.dev> Date: Fri, 15 May 2026 11:27:14 +0200 Subject: [PATCH] Fix responsiveness of data tables --- content/post/beam-process-memory-usage.md | 2 ++ sass/_main.scss | 8 ++++++-- templates/shortcodes/table.html | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 templates/shortcodes/table.html diff --git a/content/post/beam-process-memory-usage.md b/content/post/beam-process-memory-usage.md index 56a1565..9b70368 100644 --- a/content/post/beam-process-memory-usage.md +++ b/content/post/beam-process-memory-usage.md @@ -389,6 +389,7 @@ Elixir 1.14.5 (compiled with Erlang/OTP 25) The results are as follows (in bytes of peak memory footprint returned by `/usr/bin/time` on macOS): +{% table() %} | Implementation | 1k | 100k | 1M | | -------------- | -------: | --------: | ---------: | | Original | 45047808 | 452837376 | 4227715072 | @@ -397,6 +398,7 @@ The results are as follows (in bytes of peak memory footprint returned by | Count | 43732992 | 313507840 | 2780540928 | | Registry | 44453888 | 311988224 | 2787237888 | | RemoteCall | 43597824 | 310595584 | 2771525632 | +{% end %} As we can see we have reduced the memory use by about 30% by just changing from `Task.async/1` to `spawn/1`. Further optimisations reduced memory usage diff --git a/sass/_main.scss b/sass/_main.scss index 964ef8d..5fca788 100644 --- a/sass/_main.scss +++ b/sass/_main.scss @@ -188,10 +188,14 @@ blockquote { } } +.table { + overflow: auto; +} + table { border-collapse: collapse; - width: 100%; - margin: 40px 0; + // width: 100%; + margin: 1em 0; } table, th, td { diff --git a/templates/shortcodes/table.html b/templates/shortcodes/table.html new file mode 100644 index 0000000..0d7db8b --- /dev/null +++ b/templates/shortcodes/table.html @@ -0,0 +1,3 @@ +