Closed volsa closed 1 month ago
Attention: Patch coverage is 91.72932%
with 11 lines
in your changes are missing coverage. Please review.
Project coverage is 95.64%. Comparing base (
d21bfc7
) to head (cfedf60
).
Files | Patch % | Lines |
---|---|---|
src/typesystem.rs | 60.00% | 10 Missing :warning: |
src/validation/statement.rs | 92.85% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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 theDataTypeInformation
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.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 thetype_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)