Do we need faster regex?

Hipreme msnmancini at hotmail.com
Mon Dec 18 18:20:51 UTC 2023


On Monday, 18 December 2023 at 18:09:16 UTC, H. S. Teoh wrote:
> On Tue, Dec 19, 2023 at 06:47:00AM +1300, Richard (Rikki) 
> Andrew Cattermole via Digitalmars-d wrote:
>> Yeah basically std.regex is no longer the cause for importing 
>> std.regex slowdown.
>> 
>> Its stuff like std.conv and std.uni.
>
> I haven't noticed too much horrible slowdown from std.conv, but 
> std.uni could use some fixing. I'm tempted to suggest that 
> those internal tables in std.uni should be pre-generated rather 
> than done at compile-time. There comes a point where repeatedly 
> doing something at every compile just isn't worth it when the 
> desired output could be autogenerated beforehand and saved as a 
> straight .d file with hard-coded values.
>
>
> T

std.conv slowdown comes from `std.conv.to!float` specifically. 
The other ones looks fine I guess.

about rikki's statement, it can help, but whenever you import the 
values, it will still take a lot of time in compilation time, you 
can look at `core.sys.windows.uuid` for reference, most of the 
compilation time spent on any windows module is this one taking a 
lot, and when you look at it, it is only a lot of definitions. 
So, yes, I think it could be a lot better. One example I've done 
was to separate the complete generation in Metal and never import 
the file which actually does all the CTFE and mixin's. Think of 
this file like only important to the linker and not needed to be 
used. A .di file with only definitions could help even more, and 
let other thing implement it so only the symbols would be 
imported.


More information about the Digitalmars-d mailing list