Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 53038 invoked from network); 10 Jul 2000 22:56:04 -0000 Received: from adsl-63-198-47-229.dsl.snfc21.pacbell.net (HELO costin.dnt.ro) (63.198.47.229) by locus.apache.org with SMTP; 10 Jul 2000 22:56:04 -0000 Received: from localhost (costin@localhost) by costin.dnt.ro (8.9.3+Sun/8.9.1) with ESMTP id PAA01823 for ; Mon, 10 Jul 2000 15:55:24 -0700 (PDT) From: costin@eng.sun.com X-Authentication-Warning: costin.dnt.ro: costin owned process doing -bs Date: Mon, 10 Jul 2000 15:55:24 -0700 (PDT) X-Sender: costin@costin.dnt.ro To: general@xml.apache.org Subject: Re: HotSpot Bashing (was RE: [spinnaker] Announce) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII > How do you know when you're building a next gen parser? Wasn't Xerces a > next gen parser at some point? > > If Sun releases a new VM while Spinnaker is still being developed, will you > go back and change the way it was written? You are right, HotSpot is not the last or only VM, and we want to be able to optimize for JDK1.1, HotSpot, or any other VM - or not optimize at all. This is not possible in xerces, which has JDK1.1 optimizations and nothing else. Having HotSpot detect JDK1.1 optimizations is not a solution, we need to use JDK1.1 optimizations in JDK1.1 and normal ( unoptimized ) code in HotSpot ( or even Hot-Spot optimized code for hotspot and jit optimized code when a JIT is used ). This will also help a lot with the code clarity: try { fgTempBuffer[outOffset] = (char)ch; outOffset++; } catch (NullPointerException ex) { fgTempBuffer = new char[CHUNK_SIZE]; fgTempBuffer[outOffset++] = (char)ch; } catch (ArrayIndexOutOfBoundsException ex) { char[] newBuffer = new char[outOffset * 2]; System.arraycopy(fgTempBuffer, 0, newBuffer, 0, outOffset); fgTempBuffer = newBuffer; fgTempBuffer[outOffset++] = (char)ch; } Is equivalent with: if( fgTempBuffer == null ) fgTempBuffer = new char[CHUNK_SIZE]; if( outOffset == fgTempBuffer.length ) realloc(); fgTempBuffer[ outOffset ++ ] = ch; The first piece can't be optimized by hotspot ( AFAIK ). It is a great optimization for JDK1.1, and it should be used in 1.1 VMs. This kind of code is used all over xerces, in all classes. I don't think it's bad code, but you don't have to pay the price of 1.1 optimizations in 1.3 VMs ( even if HotSpot could detect it's 1.1). Costin