RenderObject::canvas micro optimization

Dave Hyatt hyatt at apple.com
Mon May 10 20:28:47 CEST 2004


Yes, it should.  In fact, I remember thinking this myself at the time I 
wrote:

> RenderCanvas *r = static_cast<RenderCanvas 
> *>(this->document()->renderer())

but I never did anything about it. :)

Nice catch.

dave

On May 9, 2004, at 2:17 PM, Leo Savernik wrote:

> Hello,
>
> RenderObject::canvas is defined as follows (pseudo-code):
>
> RenderObject o = this;
> while (o->parent()) o = o->parent();
> return static_cast<RenderCanvas *>(o);
>
> which is O(depth of tree)
>
> However, Safari determines the canvas in some places with
> RenderCanvas *r = static_cast<RenderCanvas 
> *>(this->document()->renderer())
>
> which is O(1).
>
> Shouldn't this code become RenderObject::canvas' new implementation so 
> that
> all callers of RenderObject::canvas can take advantage of it?
>
> mfg
> 	Leo
> _______________________________________________
> Khtml-devel at kde.org
> https://mail.kde.org/mailman/listinfo/khtml-devel



More information about the Khtml-devel mailing list