This made me think about lazy initialization of NodeListWrapper's. The
two options seem to be:
1) store an array of pure elements and turn them into wrappers on
the fly
2) turn elements into wrappers when instantiating `NodeListWrapper`
and then return these (already prepared) wrappers.
On Aug 22, 7:14 am, T.J. Crowder [EMAIL PROTECTED] wrote:
This made me think about lazy initialization of NodeListWrapper's. The
two options seem to be:
1) store an array of pure elements and turn them into wrappers on
the fly
2) turn elements into wrappers when instantiating
NodeLists are live, though, aren't
they?http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-..
Of course, but our selector implementation turns them into an array.
Ah, okay, sorry about that. I was thinking live. I've read
On Aug 22, 9:09 am, T.J. Crowder [EMAIL PROTECTED] wrote:
NodeLists are live, though, aren't
they?http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-..
Of course, but our selector implementation turns them into an array.
Ah, okay, sorry about that. I was
On Aug 22, 10:33 am, John-David Dalton [EMAIL PROTECTED]
wrote:
T.J. $$W and $$ are the same thing (just named $$W so that we know we
are talking about the new implementation).
I kind of like the idea of lazy wrapping.
That would speed up the initial selector while offering a one time hit
When iterating over a `source` items, we don't know if an item is a
wrapper or an element.
My _each implementation deals with that case pretty efficiently. The
ongoing runtime cost of item() and _each() is pretty much one extra
comparison.
Before we can do benchmarks, we should ask people
On Aug 22, 11:30 am, T.J. Crowder [EMAIL PROTECTED] wrote:
I'm not sure if we should pre-wrap elements or do the lazy init.
First approach hits the memory consumption, while second - run-time
performance. We'll need benchmarks for this.
Yeah. I know you were initially thinking pre-wrap,
@JDD: Sorry, missed your note in the melee.
T.J. $$W and $$ are the same thing (just named $$W so that we know we
are talking about the new implementation).
Depending on how $$W is implemented, I may pretty strongly want
Prototype's excellent selectors but without automatic element
wrapping.
@Ken:
Of course an argument /against/ lazy wrapping is that we would have to
make this.raw a private property because you wouldn't know if it
contains wrapped or unwrapped elements.
Yeah, that was my primary reason for keeping it separate; originally I
was thinking integrated as well but I'm