Open SPGoding opened 1 year ago
Possibly the parser could start with some supported version and keep track of versions were there were no changes to the thing it's parsing, based on mcdoc (and keep the version range that satisfies everything in the function in a list).
Then, only re-parse with another version, if that's not added to the supported range by the first pass.
I see the potential issue with performance, so i have a couple suggestions to attach: Problem 1 - at least to my knowledge, you cannot specify more than 2 specific pack formats, it's always parsed as a range of them. Solution 1a - Flag snapshot overlays as "unsupported", but not a warning to annoy us all(this also applies to any other unsupported pack format, please i would like to have this active when i update a pack before ya'll update the extension. Also i have personally found it faster to upkeep each snapshot with my packs, instead of catching up after a few) Solution 1b - Initial parsing parses the main data folder, then each overlay as it gets activated going up the versions(overlay 44 would load & be parsed, then overlay 55 would load on TOP and be parsed for example, and personally i name my overlays based on pack format they support). Then only re-parse each file as it is changed, and everything else is cached.
Problem 2 - parsing too many overlays being laggy Solution 2 - while this is an obscure one, when parsing more than say 7 overlays, instead of parsing on update, it either parses like once per minute, or can be manually told to re-parse.
To keep the mental model easy we can construct a separate symbol table for each version that the data pack claims to support. Common symbols may be shared across the symbol tables to save memory (why isn't the symbol table immutable who the heck wrote this piece of hot garbage). We can then attempt to validate the entire data pack for each version although that could be a performance nightmare, especially when code in the common part of all versions is changed. Not sure if there's any way around it though.