On Wednesday, 8 December 2021 at 22:18:23 UTC, forkit wrote:

It's also worth noting the differences in compiler output, as well as the time taken to compile, these two approaches:

(1)
string str = "abc;def;ab".filter!(c => c != ';').to!string;

(2)
string str = "abc;def;ab".replace(";", "");

see: https://d.godbolt.org/z/3dWYsEGsr

You're passing a literal. Try passing a runtime value (e.g. a command line argument). Also, -O2 -release :) Uless, of course, your goal is to look at debug code.

Reply via email to