RESOLVED FIXED 15835
Switch List to Vector (.5% speedup)
https://bugs.webkit.org/show_bug.cgi?id=15835
Summary Switch List to Vector (.5% speedup)
Geoffrey Garen
Reported 2007-11-04 15:49:14 PST
Patch coming.
Attachments
Patch (29.38 KB, patch)
2007-11-04 15:49 PST, Geoffrey Garen
darin: review+
Geoffrey Garen
Comment 1 2007-11-04 15:49:30 PST
Darin Adler
Comment 2 2007-11-04 16:44:33 PST
Comment on attachment 17039 [details] Patch The best idiom for iterating a vector is to use indices and not bother with iterator objects at all. I believe it's faster than the iterator version, and certainly more readable! But for speed, you'd want a version that doesn't do a range check each time. r=me (as is -- those comments above are "food for thought")
Eric Seidel (no email)
Comment 3 2007-11-05 13:42:22 PST
Nice! Sad it was so little...
Geoffrey Garen
Comment 4 2007-11-05 13:47:05 PST
Committed revision 27448. Iteration by index would certainly be more readable. I think we could do that if we made "return undefined if I'm past the end" a special-case function instead of the default behavior of operator[]. (Hopefully we could do that without introducing subtle regressions!) Still, I worry that iteration by index might be slightly slower, based on this check-in by Maciej: http://trac.webkit.org/projects/webkit/changeset/27339. It seems like using a pointer directly into the VectorBuffer can be faster than using an integer offset into the Vector, which translates into a pointer into the VectorBuffer. (Maybe the compiler can optimize that translation out, though.)
Geoffrey Garen
Comment 5 2007-11-05 13:47:32 PST
Changeset 27448.
Note You need to log in before you can comment on or make changes to this bug.