- From: Arnaud Le Hors <lehors@w3.org>
- Date: Thu, 07 May 1998 18:08:18 +0200
- To: www-dom@w3.org
Michael Amster wrote: > Java has a high cost of object instantiation, so > object reuse is paramount to a good implementation See, the problem is that this may not even be always true because it depends on the VM and/or JIT compiler you're using. As a proof see James Gosling's claim about Hotspot at JavaOne [1]: (Short lived object benchmark: 18 secs classic VM, 8 sec's on Jview, 6 sec's malloc/free C, 2 sec's HotSpot) I think this clearly shows that it's very difficult, if not impossible, to take this kind of constraints into account while designing an API such as the DOM in a programming language independent manner. This said it's true that we could design the API quite differently in order to avoid creating that many objects. For instance, instead of having something like: NodeIterator getChildNodes() we could have instead: void getChildNodes(NodeIterator it) This would allow passing an iterator which has been created separately and possibly already used before. Or it could be: NodeIterator getChildNodes(NodeIterator it) which would return a new iterator if it==null [1] http://www.javasoft.com/javaone/javaone98/keynotes/gosling/hotspot.htm -- Arnaud Le Hors - W3C, User Interface Domain - www.w3.org/People/Arnaud
Received on Thursday, 7 May 1998 12:12:18 UTC