Ticket #1636 (closed feature: fixed)

Opened 5 years ago

Last modified 5 years ago

cache array length where possible

Reported by: tschaub Owned by: euzuro
Priority: minor Milestone: 2.7 Release
Component: general Version: 2.6
Keywords: Cc:
State: Complete

Description

This patch could be far bigger, and I'm happy to change this elsewhere if others think it a good thing.

For long (and non-sparsely populated) arrays, a fast loop that is still readable is one that caches the array length.

Nice stats to for cases with long arrays from here:  http://blogs.sun.com/greimer/resource/loop-test.html

Attachments

len.patch Download (82.9 KB) - added by tschaub 5 years ago.
cache array length where possible

Change History

Changed 5 years ago by tschaub

  • owner set to tschaub
  • status changed from new to assigned
  • state set to Review

Changed 5 years ago by elemoine

  • state changed from Review to Commit

Changed 5 years ago by euzuro

can we do a sweep and implement this everywhere?

Changed 5 years ago by tschaub

cache array length where possible

Changed 5 years ago by tschaub

  • owner changed from tschaub to euzuro
  • status changed from assigned to new
  • state changed from Commit to Review

Tests pass in FF 2, IE 7, and Safari 3.

Changed 5 years ago by crschmidt

  • state changed from Review to Commit

I've tested that this patch does offer some clearly measurable gains in geometry intersection tests with modest-sized geometries. I see no reason this shouldn't go in.

Changed 5 years ago by tschaub

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [7627]) Caching array length instead of accessing it with each iteration. r=crschmidt (closes #1636)

Note: See TracTickets for help on using tickets.