parsingdata / metal

A Java library for parsing binary data formats, using declarative descriptions.
Apache License 2.0
18 stars 9 forks source link

Add cache for more efficient refs #399

Closed rdvdijk closed 1 year ago

rdvdijk commented 1 year ago

Using ref is sometimes extremely expensive when referencing values parsed very "early" in large ParseGraphs. This is a common pitfall in many tokens. We can improve this by creating a cache for all parsed values, which is used by evaluating a ref.

An example: the CFB format contains a 'sector size' in its header, which is used throughout the token. The lookup of this sector size becomes extremely slow in CFB with large sector chains.