Using core.reflect to rewrite code

Stefan Koch uplink.coder at googlemail.com
Wed Aug 11 23:58:21 UTC 2021


On Tuesday, 10 August 2021 at 23:51:29 UTC, Stefan Koch wrote:
> Good evening everyone,
>
> before going to bed I have been playing with my new project 
> again.

I've manged to improve the performance of using core.reflect by 
roughly 2x because I realized that class literals created by 
core.reflect don't need "scrubbing".

Scrubbing in this case means walking the expression-tree of an 
expression created by CTFE and removing "ctfe-only-features" from 
it thereby making it a proper ASTNode which can be inserted 
without "damaging" the tree.

To be honest I am surprised that I was able to get a 2x 
performance win for core.reflect without major architectural 
changes.

I guess sometimes one is lucky :)

Now core.reflect is relatively fast it's time to play around with 
it :)

Please let me know what you think about the examples I have 
posted so far.

Cheers,

Stefan


More information about the Digitalmars-d mailing list