<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Vincent Mader - Notes</title>
    <subtitle>Physicist turned software engineer in Ulm: iOS apps, web platforms and physics simulations.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://mader.xyz/notes/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://mader.xyz/notes/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-11-25T00:00:00+00:00</updated>
    <id>https://mader.xyz/notes/atom.xml</id>
    <entry xml:lang="en">
        <title>How the Lab&#39;s engine got 43% smaller</title>
        <published>2026-11-25T00:00:00+00:00</published>
        <updated>2026-11-25T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://mader.xyz/notes/engine-43-percent-smaller/"/>
        <id>https://mader.xyz/notes/engine-43-percent-smaller/</id>
        
        <content type="html" xml:base="https://mader.xyz/notes/engine-43-percent-smaller/">&lt;p&gt;Every simulation in the &lt;a href=&quot;/lab/&quot;&gt;Lab&lt;/a&gt; runs on the same engine: Rust, compiled to WebAssembly, loaded once and cached. Until this week a visitor downloaded 1.59 MB of it, 600 KB after compression. Two changes brought that down to 343 KB.&lt;/p&gt;
&lt;h2 id=&quot;text-nobody-downloaded-it-for&quot;&gt;Text nobody downloaded it for&lt;/h2&gt;
&lt;p&gt;Each of the 98 simulations carries a long description: the history, the physics, what the presets show. The Lab pages need that text, but they get it when the site is built, not in the browser. The browser only ever asked the engine for parameters and presets. Still, every description sat in the WebAssembly file, more than 300 KB of text.&lt;/p&gt;
&lt;p&gt;The fix is a Cargo feature. The descriptions now go through a small macro that keeps them only when the feature &lt;code&gt;docs&lt;/code&gt; is on. The site generator turns it on, the browser build leaves it off, and the compiler drops the strings entirely. The engine went from 1.59 MB to 1.24 MB, and nothing on the pages changed.&lt;/p&gt;
&lt;h2 id=&quot;brotli-without-a-brotli-module&quot;&gt;Brotli without a brotli module&lt;/h2&gt;
&lt;p&gt;The server compressed everything on the fly with zstd or gzip. Brotli at its highest level compresses this kind of file about a quarter better, but it is far too slow to run per request, and neither the proxy nor the nginx image in front of the site has a brotli encoder.&lt;/p&gt;
&lt;p&gt;It does not need one. The deploy script now writes a &lt;code&gt;.br&lt;/code&gt; copy next to every CSS, JavaScript and WebAssembly file, once, at the highest level. nginx checks whether the browser accepts brotli, serves the copy with the right content type and encoding header, and the proxy passes an already encoded response through untouched. Browsers that do not ask for brotli still get gzip or zstd.&lt;/p&gt;
&lt;h2 id=&quot;the-result&quot;&gt;The result&lt;/h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;Before&lt;/th&gt;&lt;th&gt;After&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Engine, uncompressed&lt;/td&gt;&lt;td&gt;1.59 MB&lt;/td&gt;&lt;td&gt;1.24 MB&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Engine, as downloaded&lt;/td&gt;&lt;td&gt;600 KB (gzip)&lt;/td&gt;&lt;td&gt;343 KB (brotli)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;That is 43% less to download before the first simulation starts, for one Cargo feature and a few lines of nginx configuration.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>From a bench finder to finder-kit</title>
        <published>2026-11-24T00:00:00+00:00</published>
        <updated>2026-11-24T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://mader.xyz/notes/from-a-bench-finder-to-finder-kit/"/>
        <id>https://mader.xyz/notes/from-a-bench-finder-to-finder-kit/</id>
        
        <content type="html" xml:base="https://mader.xyz/notes/from-a-bench-finder-to-finder-kit/">&lt;p&gt;&lt;a href=&quot;/work/baenkle/&quot;&gt;Bänkle&lt;/a&gt; answers one question: where is the nearest public bench? A compass points the way, and the data comes from OpenStreetMap. While building it I noticed that almost nothing in it was about benches.&lt;/p&gt;
&lt;h2 id=&quot;the-same-app-many-times&quot;&gt;The same app, many times&lt;/h2&gt;
&lt;p&gt;Swap benches for pubs, toilets or drinking fountains and the app stays the same: a map, a compass, a list of nearby places, filters, opening hours, widgets. So I pulled the shared parts out into finder-kit, a Swift package for the app and a Rust service for the data. A new app is a thin shell on top: its own name, colors, icons and texts, and one layer of places.&lt;/p&gt;
&lt;h2 id=&quot;one-import-many-layers&quot;&gt;One import, many layers&lt;/h2&gt;
&lt;p&gt;The server never queries OpenStreetMap while answering a request. Once a month an importer reads the whole planet file and fills one layer per app. Each layer is a small TOML file that selects the OpenStreetMap tags it needs, and a shared crate turns opening hours into open and unknown intervals, so an app can say “hours unknown” instead of guessing.&lt;/p&gt;
&lt;p&gt;The hard part was the zoomed-out map. MapKit cannot draw millions of markers, so the service precomputes place counts on 13 grid levels, built in the same import, and the map shows the real total from a street up to the whole world.&lt;/p&gt;
&lt;h2 id=&quot;the-first-app-on-it&quot;&gt;The first app on it&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;/work/wo-bier/&quot;&gt;Wo Bier?&lt;/a&gt; is the beer layer plus its own profile: it shows pubs, beer gardens and shops that are open for the length of your walk, and a compass walks you to the nearest one. It went live in the App Store on 24 November 2026. Bänkle’s live API already runs on the shared service, and the Bänkle app itself is moving onto the package next.&lt;/p&gt;
</content>
        
    </entry>
</feed>
