kip
ex_cldr Core Team
Tz_world / timezone_boundary_builder update
tz_world is a library that maps a location (lat, lng) to a timezone.
From time-to-time the base data in timzone_boundary_builder is updated based upon updates to the IANA timezone database.
With the IANA timezone database being updated to version 2020a on April 23rd, timezone_boundary_builder has now also updated its release.
For current users of tz_world you can update the data source in two ways:
- Run
mix tz_world.update - In a running system, call
TzWorld.reload_timezone_data/0. Application restart is not required - the new data is downloaded and installed in the running system.
Trending in Announcing
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly.
One of i...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses:
I had hope...
New
Other Trending Topics
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Introduction
Founded in 2017 by landscape ecologist and fire mitigation expert Harry Statter, Frontline developed the first fully integra...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











First Post!
LostKobrakai
Yeah, I can finally replace my manually imported world map in my db without update logic
Most Liked
kip
I have refactored tz_world to separate different backend strategies. Please feel free to give it a try, I plan to release a new version on hex later this week.
New Backend Access modules
TzWorld.Backend.Memorywhich retains all data in memory for fastest performance at the expense of using approximately 1Gb of memoryTzWorld.Backend.Detswhich uses Erlang’s:detsdata store. This uses negligible memory at the expense of slow access times (approximaltey 500ms in testing)TzWorld.Backend.DetsWithIndexCachewhich balances memory usage and performance. This backend is recommended in most situations since its performance is similar toTzWorld.Backend.Memory(about 5% slower in testing) and uses about 25Mb of memoryTzWorld.Backend.Etswhich uses:etsfor storage. With the default settings of:compressedfor the:etstable its memory consumption is about 512Mb but with access that is over 20 times slower thanTzWorld.Backend.DetsWithIndexCacheMost interesting is that by caching the bounding boxes in memory, the backend
TzWorld.Backend.DetsWithIndexCachelooks to be a good balance of memory utilisation and performance. It uses only ~20Mb of memory to store the bounding boxes and has performance similar to the in-memory backend.Basic Benchmark
kip
It’s been a year since any functional updates or bug fixes for tz_world so today I published
tz_world version 1.0.0.Really, the only change is the version number. Still actively maintained, just no open issues or functional enhancement requests.
kip
Yep, turns out its really big (and this is the version not including geo data for the oceans).
I will, for the next release:
behaviour:detsbackend (first priority)PostGisbackend (which was already written by the original author of tz_world)Probably going to take a couple of weeks to get this done.
Thanks for the vigilance @LostKobrakai.
Last Post!
kip
I’ve just published tz_world version 2.1.0.
The primary changes are:
The addition of a new backend, TzWorld.Backend.SpatialIndex that implements a pure-Elixir R-tree (Sort-Tile-Recursive packed) index. This index results in substantially faster lookups.
File and
:jsonstreaming to optimise the memory usage when runningmix tz_world.update. This task used to consume a peak of 980Mb. It now consumes a peak of 70Mb.The reason for the major release bump are:
The removal of two backends that just aren’t good choices:
TzWorld.Backend.MemoryandTzWorld.Backend.Ets; andThe new format of the on-disk data resulting from the new streaming build.
Performance comparisons
Benchmarked against the previous backends across a categorised fixture set (dense regions, sparse/large zones, small/thin zones, ocean points with no match, points adjacent to the international date line):
ocean(no-match)sparse_or_largedense(cities)small_or_thinThe largest wins are on no-match queries: previously, points in the open ocean caused a full scan of every shape’s bounding box; the R-tree exits at the root.
Memory comparison of
mix tz_world.updateVersion 2.0 rewrote the data-update pipeline to stream end-to-end. The source zip is downloaded straight to a temp file (no in-memory body), unzipped to disk (no in-memory JSON), parsed in 64 KiB chunks via OTP’s built-in
:jsonmodule with a feature-diverting decoder callback, and eachGeo.Polygon/Geo.MultiPolygonis written to the on-disk index as it is decoded. The full GeoJSON is never resident in memory at any point.Measured BEAM peak memory of
mix tz_world.updateon the without-oceans dataset (158 MB GeoJSON, 419 shapes, post-GC sampled):