Overhead of DIP1036

Walter Bright newshound2 at digitalmars.com
Wed Jan 10 20:19:46 UTC 2024


On 1/9/2024 3:33 PM, Steven Schveighoffer wrote:
> I find it bizarre to be concerned about the call performance of zero-sized 
> structs and empty strings to writeln or writef, like the function is some 
> shining example of performance or efficient argument passing. If you do not have 
> inlining or optimizations enabled, do you think the call tree of writefln is 
> going to be compact? Not to mention it eventually just calls into C opaquely.
> 
> Note that you can write a simple wrapper that can be inlined, which will 
> mitigate all of this via compile-time transformations.
> 
> If you like, I can write it up and you can try it out!

I've been aware for a long time that writeln and writefln are very inefficient, 
and could use a re-engineering.

A big part of the problem is the blizzard of templates resulting from using 
them. This issue doubles the number of templates. Even if they are optimized 
away, they sit in the object file.

Anyhow, see my other reply to Timon. I may have found a solution. I'm interested 
in your thoughts on it.



More information about the Digitalmars-d mailing list