-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance got worse in the last 2 weeks #1127
Comments
Did some quick research and it looks like I have unlocked an achievement, unintentionally fucking up the performance by a lot due to 94a74fd. Specifically the Picture of |
Also https://plc-lang.github.io/metrics/ wasn't able to detect any performance regressions, we really need to find some big open source library which we can include in the metrics... |
This PR refactors how enum variants are stored in the index, removing the `enum_qualified_variables` entry in the Index and instead storing all enums variants in the [`DataTypeInformation`](https://github.com/PLC-lang/rusty/blob/b357a05cb064eb21fed110b6d7c5f543f72c18e8/src/typesystem.rs#L361) struct. Querying enum variants was the main motivation here, as enums are stored unfavorably in the Index currently. Specifically enum variants are stored in an HashMap with their keys being their qualified name, which makes it hard to get all variants of an enum. For example an enum defined in main such as `Color : (red, green, blue)` is currently represented as `__main_color.red`, `__main_color.green` and `__main_color.blue` which requires raw string manipulation & comparison degrading performance as described in this [issue](#1127). Retrieving all variants of an enum in this PR is done by querying for an enum retrieving its datatype, then accessing the `variants` field which is done in O(1) because we're querying the `type_index` which is behind a HashMap. Finding a specific enum variant is still linear however. tl;dr The performance of `plc check` in one of our bigger internal projects is back to 2 seconds (from previously 2-4 minutes)
It might be the change with the parser errors, but I noticed that on big projects a lot of time would pass before we see the first error. We should investigate that.
The text was updated successfully, but these errors were encountered: