pxp-lang / pxp

A suite of high-performance tools for PHP developers – includes a code formatter, static analyser, language server and superset language.

Home Page:https://pxplang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce a "parser cache"

ryangjchandler opened this issue · comments

This shouldn't be part of the parser crate, but rather a separate crate that accepts some sort of SourceFile (name not set in stone) and can be hit prior to parsing a file to check for a cached version of the AST.

Tbh, this isn't something that I've ever really done in Rust land, but it seems like an interesting idea. My initial thoughts were to just serialize the AST using serde or something and then deserialize, but for super large ASTs that probably won't be much better than just re-parsing the file. 🤷‍♂️

Bincode (https://github.com/bincode-org/bincode) could also be a solution, but no experience with that crate.