Skip to content

Navigation Menu

Sign in
Sign up

data structures #32

jottinger started this conversation in Ideas
Aug 13, 2024 · 1 comments · 2 replies
Discussion options

The biggest concern with the data structures is that they're internal and manual - a database would be able to do what the data structures do far better. But a database: which one? H2? HSQLDB? Those would be the best candidates, but they're very common - which means you might conflict with someone else's dependency.

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

This is another good point, I think adding a DB like H2 would be fine as long as its using some sort of dependency shading. Or maybe defined as an optional dependency in Maven.

I can investigate the performance of a HSQLDB binary dataformat vs standard Java serialisation/deserialisation

You must be logged in to vote
2 replies
Comment options

you can also consider the lower level: https://www.h2database.com/html/mvstore.html . (and can be vendored).

To be noted, it's already overkill as you don't really need transactions.

Comment options

Well, the format isn't really all that important - you can certainly include an H2 binary DB in an artifact as a read-only datasource. The kicker here would be speed because querying the database can be indexed and optimized (even for SQL, which is slow in general) and would avoid the in-memory hit of the indexes; there's some in-memory hit (because they have to live SOMEWHERE) but they can be buffered, and H2's indexes are pretty efficient. The lists of regions to cities, etc., can all be dropped; they're very coarse and wouldn't be needed if a database was used, even one like H2.

But there are, of course, tradeoffs.

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

AltStyle によって変換されたページ (->オリジナル) /