200-600x slower Dlang performance with nested foreach loop
mw
mingwu at gmail.com
Tue Jan 26 21:55:47 UTC 2021
On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote:
> foreach( i, ref pStr; sortedArr )
> {
> foreach( j, ref cStr; sortedArr[ i + 1 .. $ ] )
> {
> if( indexOf( pStr, cStr ) > -1 )
> {
> // ...
> }
> }
> }
>
> Before adding the code excerpt above, the Dlang program was
> taking ~1 second on an input file containing approx. 64,000
> strings.
What's the typical length of your strings?
More information about the Digitalmars-d-learn
mailing list