Skip to content

Refactor lookup() and within()#9

Merged
marselester merged 4 commits intomasterfrom
api-refactor
Feb 22, 2026
Merged

Refactor lookup() and within()#9
marselester merged 4 commits intomasterfrom
api-refactor

Conversation

@marselester
Copy link
Owner

lookup() signature changed:

  • expects address value instead of a pointer
  • returns Result wrapper to manage memory
  • returns null instead of AddressNotFound error to be consistent with Rust implementation
  • returns network as part of Result.network

within iterator still returns structs directly, e.g., City/Country, but they're destroyed after it.next() call (iterator owns their memory).

All geolite2 and geoip2 structs no longer have _arena, init() and deinit().
Metadata also dropped them, now Reader owns its memory.

There is a regression in lookup benchmark on Intel i5 when
passing net.Address by value: ~653.5K vs ~634.5K looks per second.
Benchmark with pointer semantics showed 660.5K LPS.
@marselester marselester merged commit 1a3ff8f into master Feb 22, 2026
1 check passed
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 this pull request may close these issues.

1 participant