Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Performance of any

memeplex
2007-06-02
2013-04-19
  • memeplex
    memeplex
    2007-06-02

    Hi,

    current any() implementation has very bad performance in the general case because it first converts the original collection into a boolean collection, so it has to go through the entire collections no matter whether the first value happens to be true. I think it must shortcut evaluation as soon as a true value is found, and do nothing more than this. Implementation on top of or/and could be very elegant, but also really expensive regarding time/memory costs. The same for all().

    Thank you for your work.
    Cheers,
    Carlos

     
    • Fred Daoud
      Fred Daoud
      2007-06-10

      Hi Carlos,
      Agreed. I'll make note to fix this for the next release.
      Thank you,
      Fred