[Webkit-unassigned] [Bug 40970] [PATCH] Add equivalent of one-argument Array constructor functionality to JSC C API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 28 13:31:37 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=40970





--- Comment #5 from Geoffrey Garen <ggaren at apple.com>  2010-06-28 13:31:37 PST ---
> We can, of course, live with the empty followed by setLength(). But just feels a little bit "odd" since we do have special tuned code for this exact case, i.e. JSC internally optimizes this case instead of simply treating as a quirk.

Don't read too much into the current optimization. It will probably change in the future.

Though the current optimization is written for the JSArray constructor, I think a better solution going forward would be for JSArray to take any assignment to .length -- either an implicit assignment by the constructor quirk, or an explicit assignment by API or the .length property -- as a storage size hint.

It would also be nice if JSArray could allocate spare storage larger than MIN_SPARSE_ARRAY_INDEX, at least for a few arrays, reclaiming wasted / fragmented space as needed.

It's best not to expose these kinds of details in complex and quirky APIs. It might seem like the right thing to do looking at JavaScriptCore from the inside out, but API should be designed for understanding from the outside in.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list