[phobos] [D-Programming-Language/phobos] f81de7: Fix Issue 13877 - join assumes forward range can b...

GitHub via phobos phobos at puremagic.com
Wed Jan 7 16:27:00 PST 2015


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: f81de7d9b9a9d4d8af4615306b2b759f845bd792
      https://github.com/D-Programming-Language/phobos/commit/f81de7d9b9a9d4d8af4615306b2b759f845bd792
  Author: Peter Alexander <peter.alexander.au at gmail.com>
  Date:   2015-01-04 (Sun, 04 Jan 2015)

  Changed paths:
    M std/array.d

  Log Message:
  -----------
  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


  Commit: ba100ff803f8d266f97e9c02503e19f961be1e7e
      https://github.com/D-Programming-Language/phobos/commit/ba100ff803f8d266f97e9c02503e19f961be1e7e
  Author: Andrei Alexandrescu <andrei at erdani.com>
  Date:   2015-01-07 (Wed, 07 Jan 2015)

  Changed paths:
    M std/array.d

  Log Message:
  -----------
  Merge pull request #2837 from Poita/Issue13877

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


Compare: https://github.com/D-Programming-Language/phobos/compare/cddad765b402...ba100ff803f8


More information about the phobos mailing list