On Thu, 04 Jun 2009 17:53:31 +0200, Boris Zbarsky <bzbar...@mit.edu> wrote:

João Eiras wrote:
The overhead of comparing the previous with the new value inside the
engine is a fragment of the overhead of calling an ecmascript callback
and doing the same comparison in ecmascript.

For a given operation that has a callback listening, yes.  But most
operations do not have a callback listening, as it happens.

You are thinking along the following algorithm

if new_value != old_value then
  foreach listener in listeners
    call listener

I'm thinking in the following

if has_listeners
  if new_value != old_value then
    foreach listener in listeners
      call listener

So, unless there are listeners (which is a very simple instruction to 
evaluate), there is penalty in checking whatever needs to be checked.
And this is what UAs do, considering there is currently a big visible 
performance tradeoff when one adds no-op listeners (yes, event 
capturing/bubbling also affects it)


--

João Eiras
Core Developer, Opera Software ASA, http://www.opera.com/

Reply via email to