Subj : Re: Fwd: Rhino, Changes to JavaMembers.java To : Juerg Lehni From : Igor Bukanov Date : Wed Feb 16 2005 10:39 am Juerg Lehni wrote: > What would be the best way of submitting > such modifications, btw? The netscape.public.mozilla.jseng newsgroup? You can either send the patch to the newsgroup (I cross-post the mail there) or file an enhancement bug at bugzilla.mozilla.org against Rhino. And please use patches, not the files itself, as it is easier to see what happens. > > I have another idea for modification, this time to gain speed: I noticed > that the enumeration through all enumratable properties of an object > works by using getIds(), which creates an array containing all the ids > and simply iterates through them. Wouldn't it make more sense to use a > mechanism similar to java's iterators? Like that, no additional arrays > would have to be created each time. Also, iterating through objects like > Sets (e.g. LinkedHashSet) would then be possible, as these objects only > allow access through an iterator, and not by id at all. > > I just came acros this problem while trying to wrap a LinkedHashSet in a > JS object and noticed there may be room for improvement. I checked the > usage of getIds and noticed it wouldn't bee too much of a change, there > are 14 usages in the whole source base. getIds in the ScriptableObject > could still be kept but the default implementation could use the > iterator to create an array with the ids. The problem is that any optimization-only changes to Scriptable interface or any other public API in Rhino are hard to justify as it would break too many existing embeddings. To demonstrate how bad the situation could be consider the change in the debug implementation internals that was done in Rhino 1.5R4 in 2002. That change made Rhino incompatible with BSF library which explicitly depended on the modified classes. Since BSF is used in many projects from apache.org and since the last public release of the library was at the end of 2002, many people are still forced to use 1.5R3 release of Rhino. Regards, Igor .