std.format with wstring and dstring

monkyyy crazymonkyyy at gmail.com
Sun Sep 7 13:15:21 UTC 2025


On Sunday, 7 September 2025 at 12:29:08 UTC, Robert Schadek wrote:
> I spend one day at dconf this year and removed wstring and 
> dstring support from
> std.format to improve compile speed. std.format.FormatSpec is 
> no longer a template
> on the character type, and the bitfield template was removed as 
> well.
>
> The dub package can be found here 
> https://code.dlang.org/packages/std2_format
> https://github.com/burner/std2.format
>
> When compiling the below format call with ldc and -ftime-trace
> ```
> import std2.format;
> //import std.format;
>
> void main(){
>     string s = format("Hello %s %s %.2f", "World", 1337, 13.37);
>     assert(s == "Hello World 1337 13.37", s);
> }
>
> ```
>
> The overall compile time decreases from 290ms to 223ms and the 
> frontend time for
> the format call goes from 71ms to 23ms.
>
> Currently, alias this and toString tests fail. And I can't 
> really figure out why.
> Also some float tests fails.
>
> PR's are always welcome.
>
> Meta: Removing wstring and dstring support from std.format for 
> phobos 3 should be looked at IMHO.

wouldnt be far faster to just rip out all the c api complexity 
and just do a simple sane api?



More information about the Digitalmars-d-announce mailing list