place statements array inside CompoundStatements, it is non-empty most of the time. - #23421
Conversation
DMD perf check
|
4943cef to
6e13454
Compare
…t of the time. reduces size and avoids an extra allocation.
a7d86b6 to
a4a12a1
Compare
I could workaround dmd 2.079 not doing the return-value-optimizations by an additional ctor, so Statements are now explicitly moved into CompoundStatements and UnrolledLoopStatements. |
|
Is this good to go? |
- statementSemanticVisit.visitScope: don't call flatten for CompoundStatements, it just makes an unnecessary copy
I wasn't too happy about If the changes are not considered too disturbing, I'm fine with it now. |
|
If you can version out a fix that is not too intrusive for 2.079 that would be great. |
Ok, done. The single Array!T.move() function is not a lot shorter, though. |
b8dfc29 to
6704c62
Compare
reduces size and avoids an extra allocation.
Also avoids the indirection on usage and makes the code a bit cleaner.
The downside is that constructing the CompoundStatement with an array of statements has to move the contents of the array if we don't want the extra copy - which might not be obvious from the code. This could be done a bit nicer with rvalues, but the bootstrap compilers don't have that.