Taking a larger dataset into the browser
MobileNetwork grew out of my earlier experiments with interactive maps, including the Accidents project. This time I wanted to work with a much larger collection of points and explore what it takes to make that data useful directly in a browser. Kyle Barron's articles on Arrow, GeoParquet and deck.gl gave me a starting point, including an example using Ookla data.
The result is a map of mobile internet performance across 42 countries and 1,235,099 tile records. React handles the interface, MapLibre GL displays the CARTO vector basemap, and deck.gl draws the points and the record-density layer. In the current version, the data reaches the browser as Apache Arrow IPC files compressed with Brotli.
The first version already worked. Returning to it gave me an opportunity to look more closely at the work behind the map: downloading files, decoding them, moving arrays between threads and preparing colours. For this revision, I worked with OpenAI Codex on the analysis, a separate prototype and the implementation, then tested the results and chose which changes to keep.
Understanding what the points represent
I used Ookla Open Data, where mobile network measurements are aggregated into geographic tiles. That distinction matters when reading the map: each point represents a tile record, not an individual Speedtest measurement. The tiles are defined at zoom level 16, approximately 610.8 metres wide at the equator, with ground dimensions changing with latitude.
For the application, I prepared six values per record: longitude, latitude, ID, average download, average upload and country code. Keeping this layout made it possible to compare the old and new delivery formats using the same numerical data. The prepared files do not identify their source period, separate operators or distinguish 4G from 5G, so I treat the map as a visualization of the available performance records. An empty area alone does not establish that mobile coverage is missing.
Finding a simpler route from file to map
The original version downloaded Parquet files and decoded them through WebAssembly. Workers handled downloading and some preparation, but the Parquet decoder and the conversion to Arrow IPC ran in the main thread. The data then returned to a worker for another preparation step before reaching the map. Looking at that sequence helped explain why using workers did not, by itself, move all the processing away from the interface.
Since the country files are prepared before deployment, I could do the conversion once during data preparation and deliver Arrow IPC directly. Before changing the working application, I tested that approach in a separate prototype, first with Belgium and then with the full collection of countries. This made it possible to compare file sizes, processing and the appearance of the map without experimenting inside the production version.
There was a trade-off: uncompressed Arrow files were larger than Parquet. Brotli changed the delivery side of the comparison. For the same prototype dataset, compressed Arrow bodies totalled about 14.21 MB, compared with 21.66 MB for Parquet. The combination offered a useful balance: less data to transfer and a simpler browser pipeline, with no runtime Parquet decoding or Parquet-to-IPC conversion.
Letting countries arrive without rebuilding the whole dataset
I also changed how the application handles countries as they become ready. A small pool of workers downloads the files, reads the IPC, checks the data and prepares the selected colour palette. Ready buffers are transferred to the main thread, where each chunk keeps its own point layer. The map can fill progressively, without repeatedly joining everything into a new, larger numerical array.
For the point layer, I chose binary ScatterplotLayer attributes. The old version used callbacks to obtain coordinates and calculate colours. Now the layer receives the coordinate array and prepared colour array directly. This gives deck.gl less attribute preparation to do when data arrives, while keeping the original numerical buffers available for the map.
Each country file is still downloaded completely before its records are read. This is progressive loading across countries; it does not stream points from an unfinished response or request only the area currently visible on screen. React, MapLibre and deck.gl also continue to perform interface and rendering work in the main thread.
Being precise about zero-copy
Zero-copy was one of the ideas that attracted me to Arrow. Reviewing the implementation made me more careful about what that term means here. The useful result is quite specific: the original six-field numerical payload can be read and transferred without repacking it into another numerical array. The Float32 views point into the received, HTTP-decompressed IPC buffer, and the point layer uses those views for its positions.
That does not make the entire journey from network to screen zero-copy. Colours need new arrays, I deliberately copy download values for the background palettes, and HTTP decompression and GPU uploads still involve their own work. I kept these compromises because they support the map's actual needs: straightforward loading, reusable data and quick palette changes.
Making the colours useful
Once loading was working, I returned to how the map looked. A very wide speed scale compressed much of the colour variation into a small part of the palette. I tried lower upper limits and settled on 150 Mbps, with stops at 0, 25, 50, 75, 100 and 150 Mbps and smooth interpolation between them. Values above 150 share the final colour, while their original download and upload values remain available through an optional tooltip.
I also wanted palette switching to stay convenient. During loading, workers calculate only the selected palette. After the loaded map has rendered, a background worker prepares the other three. If a visitor requests one before it is ready, that palette takes priority; the map keeps its previous colours and matching legend until the replacement is ready across the dataset.
The density view answers a different question. It shows the relative concentration of tile records in the current view. A brighter area does not necessarily have faster internet, more underlying Speedtest measurements or better coverage. The tooltip is off by default and enables point picking when switched on.
Testing whether more workers would help
It was tempting to increase the loading pool as well. I tested fixed pools of four and eight workers in a separate preview, then repeated the comparison with alternating runs. Eight could be faster in an individual run, but it did not give a consistent improvement on my LTE connection. Both settings loaded the complete dataset successfully.
I kept the production maximum at four loading workers. It is a practical balance for the current build, and the actual pool can be smaller depending on the processor count reported by the browser. I have kept the test version for later comparisons on a different computer and a faster connection; those conditions could change the result.
What I learned from the revision
The clearest improvement was the reduction in data transferred and the removal of browser work that could be done in advance. In one comparison series with caching disabled, total page traffic fell from about 26.9 MB to 17.6 MB. Loading times were less predictable: my LTE connection varied enough that a single faster run would have been a poor basis for choosing the architecture.
The revision also changed how I describe the project. It is easier to explain the benefits when I can point to a specific conversion removed, a buffer reused or a task moved into a worker. The map still downloads all countries, retains extra colour arrays and uploads data to the GPU. Those are the current trade-offs, and there is room for further measurement on other devices.
For now, the result brings the original idea closer to what I wanted: a large collection of mobile performance data that can be explored in a browser, with a loading pipeline I can explain and test. Parquet remains useful in data preparation; the published map receives prepared Arrow files and spends more of its work on reading and displaying them.
Current source code · Open the current map
Previous version: Parquet + WASM
Historical implementation. This corrected description refers to the original code preserved in this commit on main. The application below shows the current Arrow version.
The original processing pipeline
The first version combined Parquet, parquet-wasm, Apache Arrow, Web Workers, Float32Array and deck.gl. Workers downloaded complete country files through Fetch API. A Uint8Array view exposed the received ArrayBuffer without copying its bytes, and WASM_REQUEST transferred it to the main thread.
WASM initialization, readParquet and intoIPCStream ran in the main thread. readParquet produced an Arrow table in WASM memory; intoIPCStream then serialized that table into IPC. An async JavaScript wrapper did not move these synchronous operations into a worker.
WASM_RESPONSE transferred the IPC back to the worker, where tableFromIPC read it. The worker extracted the first record batch, checked stride, allocated a new Float32Array and copied six values per record into it. FINAL_RESULT transferred that array to the main thread. taskId and taskDataStore connected the message stages.
The component created a pool of ten workers and waited for groups of files before updating the map. It combined ready arrays using new Float32Array allocations and set calls. Countries could appear before the whole dataset finished, but records were not streamed from unfinished file responses.
What the original optimizations did
TypedArrays allowed indexed access without an application object for every point. Transfer lists moved buffer ownership between threads without duplicating the numerical bytes. These were useful optimizations, but the full pipeline included Parquet decoding, IPC serialization, worker-side copying, repeated concatenation and GPU attribute preparation.
ScatterplotLayer used getPosition and getFillColor callbacks, rather than ready-made binary data.attributes. The selected D3 palette was calculated during attribute preparation; four complete palettes were not cached. The original colour calculation applied a multiplier of five to download, which was a display adjustment rather than a kbps-to-Mbps conversion.
Capabilities and limits
Parquet supports encodings, compression and readers capable of selective access. The original loader did not implement column selection, row-group skipping, range-based loading or within-file streaming. Its six-value layout was chosen by the project, not required by deck.gl. Coordinates alone did not establish GeoParquet or GeoArrow compliance.
Workers moved some processing away from the interface, but main-thread WASM and merging remained potential bottlenecks. Claims about guaranteed smoothness, maximum CPU-cache efficiency or dramatic total-memory reductions require comparable measurements. The architecture demonstrated a practical large-data map, with specific benefits and explicit compromises.
Explore the current map
The embedded application uses the current Arrow + Brotli architecture.
Technical appendix
A closer look at the implementation and the conditions behind the comparisons. Links in the main story open the corresponding note here.
↑ Back to the main story| Format | Transferred data | Relative to Parquet |
|---|---|---|
| Parquet | 21.66 MB | Reference |
| Arrow IPC, uncompressed | 29.68 MB | +37.0% |
| Arrow IPC + gzip | 15.49 MB | -28.5% |
| Arrow IPC + Brotli | 14.21 MB | -34.4% |
These figures cover country data bodies, excluding JavaScript, CSS and basemap tiles. Files were compressed ahead of deployment with gzip level 6 and Brotli quality 5, without internal IPC compression. A Netlify Edge Function streams the stored file with the correct content type and Content-Encoding, and the browser handles HTTP decompression. The loader tries gzip if Brotli delivery or validation fails. Removing parquet-wasm also removes its initialization and its separate WASM memory from this browser pipeline.
↑ Back to the main story- One reusable loading pool processes one country task per worker at a time. Its size ranges from one to four.
- Each worker reads the complete IPC response, validates the data and retains Float32 views. It prepares the selected RGBA palette and copies download values into a compact array for later palette calculation.
- Numeric, colour and download buffers are transferred to the main thread. Ready chunks remain separate, and arriving results are grouped into interface updates before the next animation frame.
- After all country tasks finish, the loading pool terminates. Once the loaded chunks have been rendered, a separate worker prepares the remaining palettes and then terminates too.
The six fields are consecutive Float32 values, taking 24 bytes per record. They are packed into an Arrow binary_data: List<Float32> column. This layout is specific to the project; it is neither six separate Arrow columns nor a standard GeoArrow geometry representation. The loader checks schema metadata, counts, country codes, coordinates and speeds, and reads all record batches and list rows.
ScatterplotLayer receives data.length and data.attributes. The position attribute reads the first two values of each record using a 24-byte stride; colours use four-component Uint8 arrays. This shortened example shows that arrangement:
new ScatterplotLayer({
id: 'speed-' + chunk.id,
data: {
length: chunk.length,
attributes: {
getPosition: { value: chunk.src, size: 2, stride: 24 },
getFillColor: { value: colors, size: 4, normalized: true }
}
},
pickable: tooltipEnabled
});A new chunk adds a layer without rewriting the already loaded numerical chunks. Data still has to be uploaded to GPU memory. The interleaved position buffer can include fields beyond the two coordinates, so avoiding CPU repacking does not automatically reduce GPU traffic or video memory.
HeatmapLayer follows a different path: it uses a logical index across the chunks and retrieves coordinates through an accessor. It is outside the binary point-layer zero-copy path.
↑ Back to the main storyArrow JavaScript creates objects describing tables, fields and record batches. A TypedArray view is also an object, but creating that view does not duplicate the bytes it reads. The zero-copy claim concerns the original numerical payload, not every JavaScript allocation. The loader verifies that the views retain the received buffer:
const bytes = new Uint8Array(await response.arrayBuffer());
const table = tableFromIPC(bytes);
const chunks = extractChunks(table);
// Keep views into the received IPC buffer.
if (!chunks.every(chunk => chunk.src.buffer === bytes.buffer)) {
throw new Error('Arrow numeric buffer was copied.');
}Passing an ArrayBuffer in a worker transfer list changes ownership without duplicating its numerical bytes. The sender's buffer becomes detached: its byteLength becomes zero, and the sender can no longer read those values through it. The receiver gains access to the transferred memory. This is ownership transfer, rather than two threads sharing the same mutable buffer.
const buffers = [...new Set(chunks.map(chunk => chunk.src.buffer))];
self.postMessage({ chunks }, buffers);
// The sender's transferred ArrayBuffers are now detached.
// Their numeric data is available to the receiving thread.These examples are shortened. The actual loader also checks responses, encodings, timeouts and dataset structure; the transfer includes the prepared colour and compact download buffers.
↑ Back to the main storyA Foreign Function Interface (FFI) is a bridge that lets code in one language or runtime use functions and data exposed by another. In a Parquet/WASM pipeline, an Arrow-compatible FFI bridge allows JavaScript to read decoded Arrow arrays directly from WebAssembly memory without first serializing them into IPC. In this version, IPC is prepared offline, so there is no browser Parquet-to-IPC transition left to remove.
GeoArrow provides standard geometry representations and can improve interoperability, especially for lines and polygons. The current point layer only needs two coordinates from the agreed six-field layout. I kept that layout for this implementation.
SharedArrayBuffer could let several threads read shared memory. However, the ordinary ArrayBuffer received from the network cannot simply become shared without copying its contents. Shared memory also needs careful access and lifetime management and cross-origin isolation, normally through COOP/COEP headers that affect external resources. For this map, a compact four-byte download copy per record was a simpler compromise. These alternatives would still leave colour calculation, HTTP decompression and ordinary WebGL uploads to perform.
↑ Back to the main storyThe background worker calculates palettes in batches targeting roughly four milliseconds and yields between batches to handle messages. This is a scheduling target, not a frame-rate guarantee. Completed inactive palettes do not recreate layers. The worker releases its compact download input when it terminates.
| Payload | Size |
|---|---|
| Six Float32 fields per record | 29.64 MB |
| One RGBA palette | 4.94 MB |
| All four cached RGBA palettes | 19.76 MB |
| Temporary download input for background calculation | 4.94 MB |
| Numeric data plus four palettes after background completion | 49.40 MB |
These sizes exclude IPC metadata and padding, JavaScript objects, decompression buffers and GPU memory. The original version calculated the selected palette through a callback and did not store all four colour arrays. The new cache uses additional memory for fast switching. Preparing three palettes later reduces work before the first full frame, but does not reduce their eventual memory cost.
The density layer uses unit weights and SUM aggregation over tile records. The speed palette uses actual Mbps, without the original display multiplier.
↑ Back to the main storyThe production formula uses the browser-reported logical processor count minus one, bounded between one and four, with a fallback of one worker if the count is unavailable. A reported count of four gives three loading workers; eight gives four. This heuristic aims to leave capacity for the interface, but it does not reserve a dedicated core. The browser may report fewer processors than the machine actually has. This cap concerns the data-loading pool, not all workers used by the map libraries.
| Measurement | 4 workers | 8 workers |
|---|---|---|
| First points | 653 ms | 702 ms |
| First full-dataset render callback | 5.49 s | 5.61 s |
| Sum of worker preparation intervals | 518 ms | 647 ms |
Eight workers won two pairs and four won three. Preparation intervals are synchronous elapsed intervals summed across workers, not measurements of actual CPU utilization. The full-frame timing uses deck.gl's render callback, not GPU completion or the moment pixels reach the display. Measurements start at the loading effect, excluding some page startup work.
The experiment forced exactly four or eight workers; it did not compare two adaptive policies. Other sizes were not evaluated systematically. More concurrent downloads share the available connection, while additional workers add startup work and compete for CPU time. The results support keeping the existing limit under the tested conditions, not declaring four universally optimal.
↑ Back to the main storyIn a series of three LTE comparisons with caching disabled, total page traffic averaged 17.63 MB for the new version versus 26.87 MB for the original. Network Finish averaged 13.94 s versus 17.21 s, and requests fell from 84 to 76. These whole-page observations include code and basemap resources; they do not isolate the effect of the data format. Finish is also different from the time at which all points have been drawn. Later runs ranged from 7.85 to 16.84 s as the connection varied.
Production data caching allows storage with mandatory freshness validation through ETag. Rendering, density aggregation and GPU uploads can still be bottlenecks, and performance on physical phones needs separate measurement.
↑ Back to the main storyGeoJSON and GeoPackage are data formats; Leaflet and OpenLayers are rendering libraries. GeoJSON is convenient for readable geometry exchange and straightforward integration. GeoPackage is a SQLite container suited to GIS, offline use and queries. I did not benchmark either format against this integrated map, so the Arrow/Parquet results are not a ranking of all GIS formats.
Leaflet supports markers, GeoJSON and SVG or Canvas rendering, with plugins for other approaches. OpenLayers also offers WebGL layers. I used MapLibre and deck.gl for a styled WebGL basemap and direct binary visualization attributes. Other libraries have their own strengths and can also handle substantial datasets with suitable designs.
A tiled map can be vector or raster. CARTO's vector tiles contain geometry styled by the browser, allowing flexible colours, labels and crisp rendering at the current scale. Raster tiles are pre-rendered images and are useful for imagery or static maps. Vector tiles are not always smaller or faster. Here the Ookla layer is separate from the tiled basemap and loads country Arrow files, rather than only visible tiles.
↑ Back to the main storySources and documentation
Project contributors
- Kirill Lisochenko - Project author: concept, original application, data preparation, visual design, testing.
- OpenAI Codex - AI coding assistant: architecture analysis, Arrow/Parquet prototyping, implementation of optimizations and assistance with testing and documentation.
- Kyle Barron - Technical inspiration through public articles and examples on Arrow, GeoParquet, WebAssembly and deck.gl.
- Open-source maintainers - The Apache Arrow, vis.gl, MapLibre, React, D3 and Vite communities provide the libraries used by the application.
- Data and basemap providers - Ookla supplies the aggregated performance data; CARTO supplies the basemap style, with OpenStreetMap contributors credited on the map.
Data and methodology
- Ookla Open Data
Source of mobile network performance aggregated into tiles.
- CARTO
Dark Matter basemap style with a vector source, used by this project.
Packages and libraries
- Apache Arrow JavaScript
Reads Arrow IPC and exposes the numeric data as TypedArray views.
- deck.gl
Renders the point and record-density layers with WebGL.
- MapLibre GL JS
Displays and styles the interactive vector basemap.
- @vis.gl/react-maplibre
Integrates MapLibre with the React interface.
- React
Manages the interface, controls and application state.
- d3-scale
Interpolates colours along the download-speed scale.
- Web Workers and TypedArrays
Prepare numeric buffers and palettes outside the main thread.
- Brotli and gzip
Compress the prepared Arrow files for HTTP delivery.
- Vite
Builds the application and supports local development.
- Netlify
Hosts the application; Edge Functions set data-delivery and cache headers.
- parquet-wasm (previous version)
Decoded Parquet through WebAssembly in the original browser pipeline.
Documentation and background reading
Geographic data formats
- GeoJSON
RFC 7946: the standard for geographic features encoded as JSON.
- GeoPackage
Capabilities of the SQLite container for geographic data.
Arrow, geometry and memory
- Apache Arrow
Numeric buffer layout and the IPC format.
- Apache Arrow JavaScript
JavaScript API for tables, vectors and IPC readers.
- MDN: transferable objects
Buffer ownership transfer and detachment of the sender’s ArrayBuffer.
- GeoArrow
Standard geometry representations in Apache Arrow.
- MDN: cross-origin isolation
Page isolation and the requirements for SharedArrayBuffer.
Rendering, workers and delivery
- deck.gl: binary data and performance · ScatterplotLayer
Binary attributes, rendering performance and point-layer configuration.
- MDN: hardware concurrency
Browser-reported logical processors and the limits of using that value to size a worker pool.
- Netlify Edge Functions API
Request and response handling, including conditional requests.
- Leaflet
GeoJSON layers and SVG or Canvas rendering.
- OpenLayers
Example of a WebGL point layer.
- MapLibre
Vector and raster map sources.
Articles and inspiration
- Kyle Barron
Zero-copy Apache Arrow with WebAssembly.
- Kyle Barron: GeoParquet
GeoParquet on the Web: browser decoding and visualization.
- Kyle Barron: GeoArrow
GeoArrow and GeoParquet in deck.gl, including the Ookla map example.
