Does performance of an event handler depends on the number of child elements

I've got a single mousedown event handler on a table with dynamically increasing number of rows (right now over thousand, in perspective should have been unlimited) and I observe a drop down in performance as the number of preloaded rows increases. The purpose of event handler is simple - figure out which row was clicked and highlight it.

I do not know exactly what causes the slowdown and I'm not sure if it's event handler. I just wonder if number of child elements that could trigger mousedown bubble can affect the performance of an event handler attached to single parent element?

Update: I came up with simple example here: http://client.infinity-8.me/table.php?num=1000 (you can pass whatever number you want to num), basically it renders a table with num rows and has a single event handler attached to a parent table. I should conclude from this, that there actually is no noticeable dropdown in performance, caused by number of child elements.

Answers


In theory it shouldn't. Only deepness should matter, since bubbling goes up by checking handlers on every level (one per level).

It performs great with 10 000 elements even on IE6.

See it in action.


Need Your Help

Activity not registered in the manifest Lint warning

android android-activity android-studio android-lint

I have a base activity from which I subclass several other activities.