-
Notifications
You must be signed in to change notification settings - Fork 6
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.
All reactions
Replies: 1 comment 2 replies
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
All reactions
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.
All reactions
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.