I did some quick testing with timezonefinderL 2.0.1 & 4.0.2 and the latest timezonefinder (4.0.3), with and without numba (a package that can speed up numpy calculations.)
pkg: |
tzfL 2.0.1 |
tzfL 4.0.2 |
tzf |
tzf + numba |
size: |
79M |
71M |
115M |
200M |
time x86: |
17 mS |
10 µS |
120 mS |
390 µS |
time rpi: |
24 mS |
30 µS |
160 mS |
— |
I ran the tests on both a relative beefy x86 platform and my rpi. The sizes are from the x86 install. I didn’t use numba on the rpi (see below.)
Also, I just used one GPS location, so not very thorough. Mostly just trying to see if it’s worth supporting timezonefinder vs timezonefinderL, and whether or not to make it configurable.
As you can see timezonefinderL 4.0.2 is much faster than 2.0.1, but it does so at the loss of accuracy. The size comparison above somewhat hides the details, because most of the space is used by numpy. timezonefinderL 2.0.1 was 8.9M, whereas 4.0.2 is only 360K. Obviously it’s thrown away a lot, which explains the much lower accuracy.
Although timezonefinder itself (46M) is much bigger than either version of timezonefinderL, the total space required is only about 60% more. And, yes, although timezonefinder is about 10x slower than timezonefinderL 2.0.1, it’s still not that unreasonable, at least in my opinion. What’s a tenth of a second between friends?
So, that brings up numba. As I mentioned, this is a package that can (and obviously does) make numpy, and hence timezonefinder, much faster. And, as you can see, it (and its own requirements) increases the total space by another 85M. Still, that’s not much these days considering typical disk sizes.
The downside to numba, though, is its installation can be a little more involved, especially on non-x86 platforms. (On x86 it’s as simple as pip install numba
.) So I think I won’t try to automatically install, or require, numba. I’ll make note of it in the instructions and point to its install instructions. If someone wants the improved speed, and doesn’t mind the extra space, and possibly more involved installation process, then they can choose to do that themselves.
Anyway, consider this a Works In Progress for now. Comments, good or bad, appreciated.