Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 42059 invoked from network); 21 Sep 2005 07:39:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Sep 2005 07:39:52 -0000 Received: (qmail 90299 invoked by uid 500); 21 Sep 2005 07:39:51 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 89795 invoked by uid 500); 21 Sep 2005 07:39:50 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 89782 invoked by uid 99); 21 Sep 2005 07:39:49 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2005 00:39:49 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 5FEC2122 for ; Wed, 21 Sep 2005 09:39:28 +0200 (CEST) Message-ID: <1529706100.1127288368390.JavaMail.jira@ajax.apache.org> Date: Wed, 21 Sep 2005 09:39:28 +0200 (CEST) From: "Lukas Zapletal (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-435) [PATCH] BufferedIndexOutput - optimized writeBytes() method In-Reply-To: <1467497219.1127204314175.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/LUCENE-435?page=comments#action_12330074 ] Lukas Zapletal commented on LUCENE-435: --------------------------------------- Will fix this. > [PATCH] BufferedIndexOutput - optimized writeBytes() method > ----------------------------------------------------------- > > Key: LUCENE-435 > URL: http://issues.apache.org/jira/browse/LUCENE-435 > Project: Lucene - Java > Type: Improvement > Components: Store > Reporter: Lukas Zapletal > Priority: Minor > Attachments: BufferedIndexOutputWriteBytes.patch > > I have created a patch that optimize writeBytes metod: > public void writeBytes(byte[] b, int length) throws IOException { > if (bufferPosition > 0) // flush buffer > flush(); > > if (length < BUFFER_SIZE) { > flushBuffer(b, length); > bufferStart += length; > } else { > int pos = 0; > int size; > while (pos < length) { > if (length - pos < BUFFER_SIZE) { > size = length - pos; > } else { > size = BUFFER_SIZE; > } > System.arraycopy(b, pos, buffer, 0, size); > pos += size; > flushBuffer(buffer, size); > bufferStart += size; > } > } > } > Its a much more faster now. I know that for indexing this not help much, but for copying files in the IndexStore this is so big improvement. Its about 400% faster that old implementation. > The patch was tested with 300MB data, "ant test" sucessfuly finished with no errors. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org