Message245128
| Author |
Robert Haschke |
| Recipients |
Robert Haschke |
| Date |
2015年06月10日.13:29:15 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1433942956.66.0.599460998017.issue24424@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Node.insertBefore() has a serious performance issue:
Using self.childNodes.index(refChild) it searches for the correct index in childNodes where the newChild should be inserted.
However, index() is linear in time w.r.t. the size of childNodes.
Hence, if there are many children, runtime dramatically increases.
Adding a simple caching mechanism (caching the previously used reference)
I was able to reduce runtime in my particular case from 16s to 1.6s, i.e. a factor of 10! |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年06月10日 13:29:16 | Robert Haschke | set | recipients:
+ Robert Haschke |
| 2015年06月10日 13:29:16 | Robert Haschke | set | messageid: <1433942956.66.0.599460998017.issue24424@psf.upfronthosting.co.za> |
| 2015年06月10日 13:29:16 | Robert Haschke | link | issue24424 messages |
| 2015年06月10日 13:29:16 | Robert Haschke | create |
|