[webkit-dev] Style: Vector::iterator vs indexed iteration

Ryosuke Niwa rniwa at webkit.org
Mon Oct 17 16:20:58 PDT 2011


Is there any rationale behind it (e.g. performance)? ggaren mentioned that
he saw some code generated by index was more efficient but it'll be great to
know some performance/code-size implications.

- Ryosuke

On Mon, Oct 17, 2011 at 4:18 PM, Sam Weinig <weinig at apple.com> wrote:

> In general, we have preferred index style.
>
> -Sam
>
> On Oct 17, 2011, at 2:48 PM, Adam Klein wrote:
>
> > A small style question came up in a review today, and I was curious if
> > there's any consensus on this: when iterating over a WTF::Vector, does
> > WebKit style prefer using a size_t vs a Vector::iterator, or
> > vice-versa?  Both show up in WebCore, but the indexed style is more
> > common (by maybe a 5-1 ratio by my rough git grep estimation), which
> > at least suggests that it may be preferred.
> >
> > - Adam
> > _______________________________________________
> > webkit-dev mailing list
> > webkit-dev at lists.webkit.org
> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20111017/2cb559cc/attachment.html>


More information about the webkit-dev mailing list