Passive Error Event

14 views
Skip to first unread message

PhistucK

unread,
May 19, 2016, 2:03:55 PM5/19/16
to blink-dev, v8-users
I am not really sure about how to test it, but I guess you know more about it.

Browsers support the "error" (window.onerror or window.addEventListener("error", ...)) event, which, if you call e.preventDefault() and the like, apparently catches the exception (I could not get it to work for some reason when I tried in the console, though).

I was thinking about the potential performance gains of adding {passive: true} support for this event - can it simplify some checks and yield (even) better performance when using the event? Will the V8 engine benefit from that in some way (for example, fire it not immediately if it knows there is more code to run at the moment, or something similar, batching and so on)?

Again, I do not know whether there is even any performance implication to adding an "error" event listener, you probably know more.

Just an idea.



PhistucK

Yang Guo

unread,
May 24, 2016, 6:46:04 AM5/24/16
to v8-users, blin...@chromium.org
Throwing errors typically are not and should not be on the critical path of any Javascript program. Therefore it makes no sense to add complexity to make this faster.

Cheers,

Yang

PhistucK

unread,
May 24, 2016, 6:55:06 AM5/24/16
to Yang Guo, v8-users, blink-dev
Not throwing errors, but whether adding an event listener to the "error" influences performance without even throwing errors. I just do not know...


PhistucK

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Yang Guo

unread,
May 27, 2016, 11:19:37 AM5/27/16
to PhistucK, v8-users, blink-dev

That doesnt sound like something in V8. The onerror listener is implemented by blink.

Yang

PhistucK

unread,
May 27, 2016, 11:31:25 AM5/27/16
to Yang Guo, v8-users, blink-dev
Of course listening to the event is implemented in Blink, but it uses V8 APIs in order to break at uncaught exceptions, so I wondered if activating this makes the execution less performant.


PhistucK

Yang Guo

unread,
May 27, 2016, 11:39:52 AM5/27/16
to PhistucK, v8-users, blink-dev

Still not entirely sure what particular scenario you have in mind. I don't think there is a performance penalty on caught exceptions if you have a listener for uncaught ones.

Yang

Reply all
Reply to author
Forward
0 new messages