Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geolocate is slow #52

Closed
Arkoniak opened this issue Apr 29, 2021 · 0 comments · Fixed by #53
Closed

geolocate is slow #52

Arkoniak opened this issue Apr 29, 2021 · 0 comments · Fixed by #53

Comments

@Arkoniak
Copy link
Collaborator

geolocate is extremely slow.

With the following setup

using BenchmarkTools
using GeoIP
using StableRNGs
import Sockets: IPv4

db = load(zipfile = "GeoLite2-City-CSV_20210427.zip")

rng = StableRNG(2021)
smp = rand(rng, db.db.v4net, 100)
ips = map(smp) do net
    IPv4(net.netaddr + 1)
end

I have the following results

julia> ip = ips[1]
ip"201.186.185.1"

julia> @btime geolocate($db, $ip)
  278.274 ms (12858984 allocations: 196.22 MiB)

julia> @time geolocate.(db, ips)
 16.092770 seconds (666.95 M allocations: 9.939 GiB, 8.59% gc time)

I use @time because there is no need in BenchmarkTools precise measurements, 16 seconds is way too long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant