pxp-lang / pxp

A suite of high-performance tools for PHP developers – includes a code formatter, static analyser, language server and superset language.
https://pxplang.org
Other
784 stars 0 forks source link

Make `SymbolTable` more useful in threaded contexts #69

Closed ryangjchandler closed 3 months ago

ryangjchandler commented 3 months ago

The current implementation of SymbolTable is a bit useless when working across multiple-threads.

The idea behind the SymbolTable is storing strings from the code once to reduce memory usage. The code was designed with single-threaded usage in mind, hence why everything uses the SymbolTable::the() method (singleton instance...).

When working across multiple threads, you would need to pass a new SymbolTable when parsing, which kind of defeats the purpose of having a SymbolTable.

Somewhere that would benefit from multi-threading is the Indexer, since we could index using multiple threads instead of doing everything sync on the main thread.

Related to #68.

ryangjchandler commented 3 months ago

I'm going to close this issue for now – I don't think a SymbolTable is the right fit for the project at this point in time.

70 actually has changes that remove it completely. The performance difference isn't awful right now, especially considering there are plenty of things still to be done on the project.

My main focus is going to be getting everything else in a working state before diving too deep into nitty-gritty performance details.