Re: Navie question about profile

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
Clemens Eisserer wrote:
> Just for fun I did some profiling using oprofile or a firefox-build
> (2.0.6) compiled built with debug enabled

For what it's worth, that usually gives incorrect numbers for two reasons:

1)  Unless you also did --enable-optimize, compiler optimizations
     (e.g. method inlining) are disabled.
2)  There are debug-only data structure verifications that make some
     algorithms actually have different computational complexity in debug
     builds (e.g. an O(N) algorithm in non-debug builds might become O(N^2)
     in a debug build because of O(N) code that checks intermediate stages
     of the computation).

> This is what I got:
> 197255   10.2989  libgklayout.so           libgklayout.so
> nsVoidArray::Count() const
> 166882    8.7131  libgklayout.so           libgklayout.so
> nsCellMap::GetDataAt(nsTableCellMap&, int, int, int)
...
> Is the Count() method really that slow, or am I getting wrong results
> because I am using a build compiled with debug on?

Count() is inlined in non-debug builds, and GetDataAt() (which is probably your 
major caller of Count()) gets called more in debug builds because of some table 
layout verification code.  So I think you're hitting both of the issues I 
describe above.

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.