Conversation
…Exp with appropriate storage space for given value - use IntegerExp.create instead of new IntegerExp in parsing and semantic - user emplace!IntegerExp64 in interpreter
8e4dca8 to
98671fe
Compare
98671fe to
d07f858
Compare
DMD perf check
Breakdown — compile hello.d
Breakdown — compile Phobos-76.1 M instructions: frontend -70.0 M (-1.94%), codegen -6.1 M (-0.41%)
All measurements
45a1e24 vs merge-base 363ee8b · about these metrics |
2f7a2ba to
8c2e994
Compare
8c2e994 to
45a1e24
Compare
|
I'm fine with doing something like this, my concern for cent/ucent is politically it doesn't look like it'll be accepted at this point. It was never considered that we could just throw an LLM at it. |
|
Even though this improves the speed a bit (I suspect memcpy with non-constant size is more expensive than a virtual call that can make the copy of 32-40 bytes with just a few instructions), I'm wondering why there is no measured drop in memory here. For my usual test building all phobos unittests, I get:
If 8 bytes per IntegerExp is saved that results in about 80 MB reduced memory (of 11 GB), and that is roughly what I'm seeing locally. |
|
ACK. I still think IntegerExp shouldn't be broken up, rather just make it able to handle N-byte integers. |
The derived classes were meant to reduce the necessary memory, but that did not turn out as much as I hoped for. So the actual implementation is probably not so important. Having to deal with multiple return types (BTW: need to have different method names) might be troublesome, too, as it might silently truncate values. I'm not convinced that the compiler needs to know about cent integers, or even arbitrarily-sized integers, though. I would prefer being able to write them as a library type that seamlessly integrates with internal types including implicit conversions. |
.. using the padding space inside Expression
The first commit removes some strange modifications of the value that no test triggers. The only remaining
setIntegercalls areassignInPlacein CTFE and when restricting the value of a bitfield.@rikkimax @ibuclaw This might be extended for cent-literals discussed in #23575