classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Speed up java.nio.ByteBuffer


From: Michael Koch
Subject: Re: [cp-patches] Speed up java.nio.ByteBuffer
Date: Thu, 12 Aug 2004 19:50:06 +0200
User-agent: KMail/1.6.2

Am Donnerstag, 12. August 2004 19:32 schrieb Florian Weimer:
> On GCJ, this patch results in a 18% improvement in speed for
> loading databases with Berkeley DB Java Edition.  Regression-tested
> (modulo changes in comments) with GCJ and a DbLoad/DbDump with JE.
>
> Further improvements will require a new class for a read-only byte
> buffer, so that the read-only flag can go.  Where should I put this
> one?

Do you realy think it is a good idea to just introduce a new class (or 
some of them) for read-only buffers ? isnt the flag not enough ?

> What are the necessary steps to get the patches installed?  Should
> I install them in the GCC repository first?

Is your copyright assignment through ? Do you have access to Classpath 
CVS ?

In general if the code is on Classpath it gets more or less 
automatically merged to libgcj (and back of course too). Normally 
Mark or I do this.

> 2004-08-12  Florian Weimer  <address@hidden>
>
>       * java/nio/ByteBufferImpl.java (put): New methods to speed up
>       ByteBuffer put and array put operations.
>
>
> ---
> /home/fw/src/gnu/classpath/java/nio/ByteBufferImpl.java       2004-06-16
> 10:57:10.000000000 +0200 +++ ByteBufferImpl.java      2004-08-12
> 19:19:28.000000000 +0200 @@ -162,7 +162,48 @@
>      position (pos + 1);
>      return this;
>    }
> -
> +
> +  /**
> +   * Relative put method. Writes <code>src</code> to the buffer,
> +   * starting at the next position.
> +   *
> +   * @exception BufferOverflowException If there is no remaining
> +   * space in this buffer.
> +   * @exception ReadOnlyBufferException If this buffer is
> read-only. +   */
> +  public ByteBuffer put (ByteBuffer src)
> +  {
> +    if (src instanceof ByteBufferImpl) {
> +      put (src.backing_buffer, src.array_offset + src.pos,
> +        src.limit - src.pos);
> +      src.pos = src.limit;
> +      return this;
> +    } else {
> +      super.put (src);
> +      return this;
> +    }

Your coding style is broken. "{" and "}" have to go in their own line, 
indented by two spaces. Then "content" in them is again indented by 
two spaces.

This patch is beautiful. When you tell me your assignment is done I 
will commit it as soon as possible.


Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]