Open
Bug 600754
Opened 14 years ago
Updated 2 years ago
Do not add and remove form controls from their form when their type changes
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: mounir, Unassigned)
Details
(Keywords: perf)
Attachments
(1 file)
924 bytes,
text/html
|
Details |
When a nsGenericHTMLFormElement has its type changing, it is removed from it's form on BeforeSetAttr and added back on AfterSetAttr. This behavior is clearly nicer considering some checks have to be done but in most situations, it's useless and setting the type might happen often (and even more with new input types). For example, each time the type is changed, we have to found the new position of the element in the list which is only needed if the element's type change from a listed one to a non-listed one (can that happen except with 'image'?). I've wrote a small test that is checking how long we spend adding input to a form if we set the type each time. Not calling AddElement/RemoveElement saves ~45% on a debug build. This might be smaller on release considering there is some special code only run in debug in AddElement. Even if we can save some time, I guess that is not really important considering adding form controls to a form isn't a very expensive operation?
Reporter | ||
Comment 1•14 years ago
|
||
Reporter | ||
Comment 2•14 years ago
|
||
I've check in a release build and the initial numbers are really smaller so I guess this should be a good thing to do because what we currently do is quite dumb but there will be no big performance win in real usage.
Comment 3•14 years ago
|
||
(In reply to comment #0) > Not calling AddElement/RemoveElement saves > ~45% on a debug build. Note, usually it makes no sense to run performance tests on a debug build. We run a lot more code there.
Comment 4•14 years ago
|
||
> what we currently do is quite dumb
Well, except for the "it's simple and shares other existing code" part, right?
As long as we keep those two properties...
Reporter | ||
Comment 5•14 years ago
|
||
(In reply to comment #4) > > what we currently do is quite dumb > > Well, except for the "it's simple and shares other existing code" part, right? > > As long as we keep those two properties... The think is I've an assert that happens because of that code (we do something when an element is added and removed from a form) so I had to introduce a boolean to not run this code when we remove/add an element because of a type change. But I agree that's not something important. (In reply to comment #3) > Note, usually it makes no sense to run performance tests on a debug build. > We run a lot more code there. I knew but I only have debug builds. I should probably have a repository with a release build for that kind of things...
Severity: normal → minor
Reporter | ||
Comment 6•14 years ago
|
||
See bug 596785
Comment 7•14 years ago
|
||
You can build both debug and release from the same repository; just use different objdirs.
Comment 8•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•2 years ago
|
Severity: minor → S4
You need to log in
before you can comment on or make changes to this bug.
Description
•