On Feb 21, 10:55 am, sarapapa <dyama...@gmail.com> wrote:
> Hi, kangax.
>
> > Element extension is very slow in JScript, so `$` is not slow due to
> > `getElementById` but is slow due to `Element.extend`.
>
> Thank you for plain explanation.
> I took the wrong understanding of a slow cause.
> I took your advice into account and tested it again.
>
> A test to read 2,000 Dom elements:
>
> sample1. $ function (Prototype.js)
> sample2. getById (A "naive" approach is clearly faster:)
> sample3. getById (But a more or less "smart" one is already slower:)
> sample4. cachedElement[id] (Cached an HTML element beforehand.)
>
> [Performance test result] (A unit of time: ms ) on InternetExplorer 6
> sample1, sample2, sample3, sample4
>    3843,     283,     283,      14
>    2734,      17,      27,      14
>    2688,      16,      28,      13
>    2719,      17,      26,      14

Yep. You can see for yourself that performance gains from caching are
practically negligible comparing to time spent on `Element.extend`.
That's one of the reasons why next major version of Prototype will
stop element extension.

[snip]

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to