Skip to content
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

make Statement, StatementNoCaseNoDefault and Declaration use SumType #489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WebFreak001
Copy link
Member

old Declaration code used algebraic, which is more efficiently replaced with sumtype.

I replaced the mixin-generated properties with manual properties, since the code is very small for them anyway and helps them being shown in DCD

Since SumType works with well-defiend types, opEquals and visitIfNotNull was trivial to implement.

Saves around 0-3 MB of actual peak RAM in a ~170 MB test environment (could just be fluctuations how much it actually is, but it will definitely include some RAM savings, since we no longer store a bunch of nulls for common types)

Easy backwards-compatible improvement I think.

Made setters backwards-incompatible on purpose, since we don't want accidental assignment of 2 different types on the same sumtype.

old Declaration code used algebraic, which is more efficiently replaced with sumtype.

I replaced the mixin-generated properties with manual properties, since
the code is very small for them anyway and helps them being shown in DCD

Since SumType works with well-defiend types, opEquals and visitIfNotNull
was trivial to implement.

Saves around 0-3 MB of actual peak RAM in a ~170 MB test environment
(could just be fluctuations how much it actually is, but it _will_
definitely include some RAM savings, since we no longer store a bunch
of nulls for common types)

Easy backwards-compatible improvement I think.

Made setters backwards-incompatible on purpose, since we don't want
accidental assignment of 2 different types on the same sumtype.
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #489 (7f7a9ce) into master (98bf0f4) will increase coverage by 0.04%.
The diff coverage is 82.27%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #489      +/-   ##
==========================================
+ Coverage   83.49%   83.53%   +0.04%     
==========================================
  Files          11       11              
  Lines        8483     8541      +58     
==========================================
+ Hits         7083     7135      +52     
- Misses       1400     1406       +6     
Impacted Files Coverage Δ
src/dparse/ast.d 71.97% <80.82%> (+1.72%) ⬆️
src/dparse/parser.d 91.43% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98bf0f4...7f7a9ce. Read the comment docs.

@@ -6354,7 +6354,7 @@ class Parser
* | $(LITERAL 'override')
* | $(LITERAL 'pure')
* | $(LITERAL 'ref')
* | $(LITERAL '___gshared')
* | $(LITERAL '__gshared')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this was intended? It pops up here and there, need to investigate what this is about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant