[Issue 13877] Problem with map+join

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jan 7 16:27:03 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13877

--- Comment #5 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/f81de7d9b9a9d4d8af4615306b2b759f845bd792
Fix Issue 13877 - join assumes forward range can be cheaply iterated twice

e.g. with `r.map!(someExpensiveFunction).join`, `join` would previously iterate
twice: once to compute length, and again to build up the result. The extra
iteration to compute length may be disproportionately expensive, so we now only
precompute length for built-in arrays, since we know those are cheap to
iterate.

The heuristic could be improved over time, although I can't think of anything
better right now.

https://issues.dlang.org/show_bug.cgi?id=13877

https://github.com/D-Programming-Language/phobos/commit/ba100ff803f8d266f97e9c02503e19f961be1e7e
Merge pull request #2837 from Poita/Issue13877

Fix Issue 13877 - join assumes forward range can be cheaply iterated twice

--


More information about the Digitalmars-d-bugs mailing list