Article View: borland.public.jbuilder.java.api
Article #1747Re: 10 MB Textfile as Input
From: Reid Pinchback
Date: Tue, 25 Sep 2001 19:58
Date: Tue, 25 Sep 2001 19:58
18 lines
2099 bytes
2099 bytes
Leif wrote: > With the readLine () method it takes more than an hour to complete my > instruction. > > How can I accelerate this process, I only need to insert a break line after > each "record" (after x characters -> "\n"). I hate to state the obvious, but stop using readLine(). It is designed to do exactly what it is doing; read everything until it gets to the end of the line. Read a bufferful at a time with read(). Check for yourself if an end-of-line was captured during the read. You are probably spending a huge amount of time in memory management; creating buffers, destroying buffers that are too small, causing cache/page faults at the O/S level. Layer your own logic on top of a reasonable size of buffer read will probably cause your program to complete in minutes or even seconds (depending on what you are doing with the text you read).
Technical Details
Message-ID:
<3BB0E1B6.57B17A14@mpi.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!paloalto-snh1.gtei.net!news.gtei.net!dfiatx1-snr1.gtei.net.POSTED!not-for-mailReferences:
<zKYp7.67$5K6.76909@news.kpnqwest.ch>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,bb41581def62114,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-09-25 12:58:29 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!paloalto-snh1.gtei.net!news.gtei.net!dfiatx1-snr1.gtei.net.POSTED!not-for-mail Message-ID: <3BB0E1B6.57B17A14@mpi.com> From: Reid Pinchback <pinchbac@mpi.com> Organization: Millennium Pharmaceuticals, Inc X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api Subject: Re: 10 MB Textfile as Input References: <zKYp7.67$5K6.76909@news.kpnqwest.ch> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 24 X-Trace: /K0ZEEp+pUFB1OkiB28wfvU3IgH2F9RhSMuk1bHTHK/Gtx5Iciqu8ptFcJdZQuhi8PCdIHeQeUQq!i87rjvXTWvIOPqIO7qpqZc0hBxapgdBTXVdi2Fv7VB0mcMxAMQl4fml2kkYbZA== X-Complaints-To: abuse@gte.net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Tue, 25 Sep 2001 19:58:19 GMT Distribution: world Date: Tue, 25 Sep 2001 19:58:19 GMT