Why is std.regex slow, well here is one reason!

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Feb 26 07:25:45 UTC 2023


On 26/02/2023 5:49 AM, Johan wrote:
> On Saturday, 25 February 2023 at 13:55:00 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> So there is a problem with time trace handling, it doesn't escape 
>> Windows paths so you end up with an exception on \T tather than \\T.
> 
> I don't quite understand what you mean.

{"ph":"M","ts":0,"args":{"name":"C:\Tools\D\ldc2-1.30.0-beta1-windows-multilib\bin\ldc2.exe"},"name":"process_name","pid":101,"tid":101},

Needs to be:

{"ph":"M","ts":0,"args":{"name":"C:\\Tools\\D\\ldc2-1.30.0-beta1-windows-multilib\\bin\\ldc2.exe"},"name":"process_name","pid":101,"tid":101},

>> I've gone ahead and modified the tool, did some cleaning up, added a 
>> second output file that allows for consumption in a spreadsheet 
>> application, sorted by duration automatically.
>>
>> I'd love to see the time trace switch upstreamed into dmd.
> 
> https://github.com/dlang/dmd/pull/13965
> 
>> We can then distribute this tool for an out of the box visualization 
>> experience that doesn't require a web browser. And of course globals 
>> need work, not just Windows path escaping ;)
> 
> I'll add the tool to LDC.
> 
>> It is an absolutely lovely tool that will ease a lot of peoples 
>> concerns over debugging compile times. Gonna be worth a blog article!
> 
> Thanks. Looking forward.
> I don't remember adding CTFE times to the traces, so that sounds like a 
> clear improvement point? Or was it still useful for you to tackle the 
> issue of the OP?

Basically right now globals are not leading to anything in the output.

```
void func() {
	static immutable Thing thing = Thing(123);
}
```

The constructor call for Thing won't show up. This is the big one for 
std.regex basically.


More information about the Digitalmars-d mailing list