PMTiles
PMTiles copied to clipboard
use geometric series formula
Any description? Can you include the comparison here? https://github.com/protomaps/PMTiles/pull/134
Hi Brandon, this PR refactors tzValues calculation to leverage geometric series formula
- Replaced the manual lookup table for
tzValueswith a direct formula based on the properties of a geometric series. - The formula
(4^z - 1) / (4 - 1)efficiently computes the same values, eliminating the need for a hardcoded array. - This approach simplifies code maintenance.
https://www.wolframalpha.com/input?i=Sum%5B2%5Ei+*+2%5Ei%2C+%7Bi%2C+0%2C+n+-+1%7D%5D
This change focuses on maintainability rather than performance optimization.
I've merged #527 with results here: https://github.com/protomaps/PMTiles/pull/527#issuecomment-2663128667