systemed / tilemaker

Make OpenStreetMap vector tiles without the stack
https://tilemaker.org/
Other
1.44k stars 229 forks source link

AttributeStore: skip locks when outputting #599

Closed cldellow closed 9 months ago

cldellow commented 9 months ago

The locks in AttributeStore are necessary only during PBF reading, to avoid concurrent mutations corrupting things.

Once we're writing the mbtiles, it's safe to read without acquiring the lock. This eliminates ~9% of system time, and ~2-3% of wall clock time.

The PR also adds a finalize() to AttributeStore, AttributeKeyStore and AttributePairStore. Nothing actually uses this yet - I initially checked the finalized variable and threw if an unsafe method was called, but that gave up the speed benefits, so I removed it again.

Perhaps in the future, a debug build could leave such checks in to detect programming errors.

systemed commented 9 months ago

Looks good - no issues that I can see. Thanks!