From java-dev-return-11645-apmail-lucene-java-dev-archive=lucene.apache.org@lucene.apache.org Tue Sep 20 09:05:54 2005 Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 26862 invoked from network); 20 Sep 2005 09:05:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Sep 2005 09:05:53 -0000 Received: (qmail 32316 invoked by uid 500); 20 Sep 2005 09:05:52 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 31813 invoked by uid 500); 20 Sep 2005 09:05: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 31795 invoked by uid 99); 20 Sep 2005 09:05:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2005 02:05:50 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [194.212.26.195] (HELO fw.qcm.cz) (194.212.26.195) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2005 02:05:58 -0700 Received: from fw.qcm.cz (root@localhost) by fw.qcm.cz (8.12.11/8.12.11) with SMTP id j8K95RDq017571 for ; Tue, 20 Sep 2005 11:05:27 +0200 Received: from xeon.qcm.cz (xeon.a.qcm.cz [192.168.10.2]) by fw.qcm.cz (8.12.11/8.12.11) with ESMTP id j8K95R2f017566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2005 11:05:27 +0200 Received: from localhost ([192.168.110.5]) by xeon.qcm.cz (8.13.1/8.13.1) with SMTP id j8K95Qwi021918 for ; Tue, 20 Sep 2005 11:05:27 +0200 Date: Tue, 20 Sep 2005 11:03:48 +0200 From: Lukas Zapletal To: java-dev@lucene.apache.org Subject: [PATCH] BufferedIndexOutput - optimized writeBytes() method Message-Id: <20050920110348.3a1fc883.lukas.zapletal@qcm.cz> Organization: QCM s.r.o. X-Mailer: Sylpheed version 2.0.0 (GTK+ 2.6.7; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on xeon.qcm.cz X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-105.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, USER_IN_WHITELIST autolearn=ham version=3.0.4 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [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 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. The patch is included in unified format. See the URL. -- S pozdravem / Best regards Lukas Zapletal sefredaktor / editor-in-chief LinuxEXPRES - opravdovy linuxovy magazin www.LinuxEXPRES.cz tel.:+420 777 003 843 --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org