kip
ex_cldr Core Team
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
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Gu...
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
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto.
pagination
cursor pagination
sorta...
New
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New
Other Trending Topics
@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
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
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
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
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
LostKobrakai
Yeah, I can finally replace my manually imported world map in my db without update logic
LostKobrakai
It seems the data is loaded into memory on startup. I’m wondering how much memory it takes to load such a db? The geojson file I dealt with was quite big iirc.
kip
I’ll look into that and revert. Thoughts on a better way to dynamically load required data instead of all data and still keep good performance?
LostKobrakai
Not really. I’ve skipped the problem and put the data in postgres and let it deal with it. But first we’ll need to know if the data you’re using is actually so big it’s worthwhile to think about it. I’m only using it once on registration of users (a.k.a. rarely), so it’s also likely dependent on the use case.
Edit:
@kip I just looked at it. The file added to
priv/is 78 MB, which is fine, but loading the data into memory swallows 1GB of memory. This might be fine for bigger machines, but not so much for smaller ones.This happens when stopping the app.
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.
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
LostKobrakai
I’m wondering how you’re dealing with overlapping timezones? Seems like only a single timezone is returned, so at least it should be documented how this is resolved.
kip
Fair call, currently I just return the first match in order to simplify the API for a consumer. Perhaps I should also add
all_timezones_at/2as well which would always return a list. Open to suggestions on how to handle the overlapping areas.kip
Fixed a few bugs, updated the documentation to reflect @lostkobrakai’s suggestion and added an even faster backend
TzWorld.Backend.EtsWithIndexCachewhich is about 40% faster thanTzWorld.Backend.Memoryalthough it does take about 512Mb. Results:Other improvements:
TzWorldmoduleUnless any nasty bugs pop up I’ll release to hex in about 24 hours.
kip
Version 0.4.0 has been published on hex. From the changelog
Breaking change
lng,lattoTzWorld.timezone_at/2the coordinates must be wrapped in a tuple. For exampleTzWorld.timezone_at({3.2, 45.32})making it consistent with theGeo.PointandGeo.PointZstrategies.Configurable backends
TzWorld.Backend.Memorywhich retains all data in memory for fast (but not fastest) performance at the expense of using approximately 1Gb of memory. Generally not recommended.TzWorld.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.DetsWithIndexCacheTzWorld.Backend.EtsWithIndexCachewhich uses:etsfor storage with an additional in-memory cache of the bounding boxes. This still uses about 512Mb but is faster than any of the other backends by about 40%Enhancements
TzWorld.all_timezones_at/2to return all timezones for a given location. In rare cases, usually disputed territory, multiple timezones may be declared for overlapping regions.TzWorld.all_timezones_at/2returns a (potentially empty) list of all time zones known for a given point. Futher testing of this function is required and will be completed before version 1.0.