Skip to content

Improve flatdata-generator speed ~12x by caching various computations, or making them lazy#265

Merged
VeaaC merged 1 commit into
heremaps:masterfrom
VeaaC:faster-generator
Jun 12, 2026
Merged

Improve flatdata-generator speed ~12x by caching various computations, or making them lazy#265
VeaaC merged 1 commit into
heremaps:masterfrom
VeaaC:faster-generator

Conversation

@VeaaC

@VeaaC VeaaC commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Changes:

  • Cache the FlatdataGenerator instance and Jinja2 Environment so templates are compiled once
  • Defer symbols() computation in find() errors to __str__() (preserves diagnostics, avoids work when exceptions are caught internally)
  • Cache Node.path and Reference.node to avoid redundant tree walks

Result generating C++ code for a 2.5k line schema: time 5.61s → 0.44s.

…making them lazy

Signed-off-by: Christian Vetter <christian.vetter@here.com>
@VeaaC VeaaC force-pushed the faster-generator branch from d29f1d4 to 1459bd1 Compare June 12, 2026 07:59
@VeaaC VeaaC merged commit 77c82af into heremaps:master Jun 12, 2026
17 checks passed
@VeaaC VeaaC deleted the faster-generator branch June 12, 2026 08:32
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