On 06/23/2013 05:42 AM, Joseph Rushton Wakeling wrote: > On Saturday, 22 June 2013 at 21:45:48 UTC, Juan Manuel Cabo wrote: >> Right, the author of the article used ldc. I'm always used >> to dmd. > > You know that you can use ldmd2 to invoke LDC using the same flags as DMD? > >> This time I used LDC 0.11.0, with: >> >> ldc2 -O -release -disable-boundscheck >> >> Times (minimum of 10 runs): >> >> before: 1617 ms >> >> after: 554 ms >> >> Conclusion: using "byWords" was 3.4 times faster with DMD >> and 2.9 times faster with LDC. > > > Any chance of GDC results? You can again use gdmd for DMD-like interface.
The computer where I tested has Kubuntu 12.04, which is too old even for gcc-4.7, and I cannot compile GDC there. The gdc version which comes in the repository fails to compile the program, even after some rearranging so that it doesn't use UFCS. Anyway, using my "byWord" range to iterate the string will surely be faster with GDC too, because tr and split can be a little slow, especially since the string is big (5MB). I tested a little more and found that using a handcoded function instead of tr, and using splitter instead of split, it's almost as fast as the byWord version. The handcoded function assumes ascii and preallocates the resulting string (with result.length = source.length). --jm
