<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-8260739278874294486.post9006376620824868081..comments</id><updated>2012-02-08T09:07:08.066-08:00</updated><category term='meta-prog'/><category term='Python'/><category term='cvs'/><category term='java'/><category term='debugging'/><category term='jdk'/><category term='latex'/><category term='benchmark'/><category term='c'/><category term='beamer'/><category term='meta'/><category term='iphone'/><category term='OpenTSDB'/><category term='Sun'/><category term='TCP'/><category term='iTunes'/><category term='git'/><category term='bibtex'/><category term='Linux'/><category term='mac'/><category term='performance'/><category term='code'/><category term='Android'/><category term='profiling'/><category term='hardware'/><category term='svn'/><category term='MacPorts'/><title type='text'>Comments on Tsuna's blog: Java IO: slowest readLine ever</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.tsunanet.net/feeds/9006376620824868081/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html'/><author><name>Benoit Sigoure</name><uri>https://profiles.google.com/117435881756559768436</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh4.googleusercontent.com/-2eVJcyL_RNo/AAAAAAAAAAI/AAAAAAAAAAA/GWKq6sXj_VE/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-4934968166510340062</id><published>2012-02-08T09:07:08.066-08:00</published><updated>2012-02-08T09:07:08.066-08:00</updated><title type='text'>If you can help it, always use mapped files with D...</title><content type='html'>If you can help it, always use mapped files with DirectBuffers. RandomAccessFile is retarded in reading all primitives, incl. readInt(), readLong(). Full JNI switch for each bytes, magic!!&lt;br /&gt;&lt;br /&gt;Of course mapping comes w/ a price of being unable ( to unmap (baring hacks)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/4934968166510340062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/4934968166510340062'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1328720828066#c4934968166510340062' title=''/><author><name>Stanimir Simeonoff</name><uri>http://www.blogger.com/profile/15526543718385237177</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/__xTSSBstVk0/SUfd3h0rubI/AAAAAAAAD_8/ANdfXBixxHw/S220/stanimirInTheBoat.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1157102681'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-2633586409076648996</id><published>2011-02-26T03:56:18.597-08:00</published><updated>2011-02-26T03:56:18.597-08:00</updated><title type='text'>For any speedy file reading on Android you need to...</title><content type='html'>For any speedy file reading on Android you need to build some class that uses an InputStream like DataInputStream then use chunked buffers and parse.&lt;br /&gt;&lt;br /&gt;Buffering the whole file obv gives you random access - into the buffer.&lt;br /&gt;&lt;br /&gt;If you have a size problem (most of us do! ;) ) then &lt;br /&gt;Performant random access and seeking makes things more complicated.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2633586409076648996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2633586409076648996'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1298721378597#c2633586409076648996' title=''/><author><name>DanMux</name><uri>http://www.blogger.com/profile/01232356329701615766</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-953940394'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-2614757827406462178</id><published>2011-01-05T23:09:39.759-08:00</published><updated>2011-01-05T23:09:39.759-08:00</updated><title type='text'>you posted this on my birthday!


YO BEN! you in s...</title><content type='html'>you posted this on my birthday!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;YO BEN! you in sf now? come visit!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2614757827406462178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2614757827406462178'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1294297779759#c2614757827406462178' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1126823543'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-495514118248932326</id><published>2010-12-15T17:23:57.806-08:00</published><updated>2010-12-15T17:23:57.806-08:00</updated><title type='text'>@Anonymous: the javadoc of RandomAccessFile doesn&amp;...</title><content type='html'>@Anonymous: the javadoc of RandomAccessFile doesn&amp;#39;t mention anything about reading byte by byte, it just says &amp;quot;This method successively reads bytes from the file&amp;quot;.  Either way, there&amp;#39;s no reason whatsoever to have such an utterly stupid implementation of readLine.  BufferedReader doesn&amp;#39;t have a seek method.  So you can either seek around or have a non-stupid readLine, but not both.  Yay.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/495514118248932326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/495514118248932326'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292462637806#c495514118248932326' title=''/><author><name>tsuna</name><uri>http://www.blogger.com/profile/06114951663056205324</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1995837882'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-589054464639832387</id><published>2010-12-15T15:22:28.229-08:00</published><updated>2010-12-15T15:22:28.229-08:00</updated><title type='text'>And what about using java BufferReader, or read(by...</title><content type='html'>And what about using java BufferReader, or read(byte[] b, int off, int len) if you need to use a RandomAccessFile ?&lt;br /&gt;If I&amp;#39;m not wrong, javadocs tell us that it&amp;#39;ll be read byte per byte, and might be inefficient...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/589054464639832387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/589054464639832387'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292455348229#c589054464639832387' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-692174216'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-8026589114556806405</id><published>2010-12-11T19:09:58.933-08:00</published><updated>2010-12-11T19:09:58.933-08:00</updated><title type='text'>@Anonymous: you could do this if you know the file...</title><content type='html'>@Anonymous: you could do this if you know the file isn&amp;#39;t too large and can fit in memory – but still, you&amp;#39;d have to implement readLine yourself because the implementation in the JDK is unacceptable.  In my case though, there&amp;#39;s another reason why I require two passes through the file, the first pass pre-computes some data that the second pass needs.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/8026589114556806405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/8026589114556806405'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292123398933#c8026589114556806405' title=''/><author><name>tsuna</name><uri>http://www.blogger.com/profile/06114951663056205324</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1995837882'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-3789912246144102939</id><published>2010-12-11T16:25:19.728-08:00</published><updated>2010-12-11T16:25:19.728-08:00</updated><title type='text'>I&amp;#39;m still new to programming, but wouldn&amp;#39;t...</title><content type='html'>I&amp;#39;m still new to programming, but wouldn&amp;#39;t it be better to use &lt;br /&gt;&lt;br /&gt;String s = &amp;quot;&amp;quot;;&lt;br /&gt;ArrayList a = new ArrayList();&lt;br /&gt;while ((s=in.readline())!=null) a.add(s);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to get the entire file which you intend to read line-by-line anyway. Then you&amp;#39;d have a.size() as the number of lines in the file, and could use a for loop to access them quickly for whatever processing needs done. I don&amp;#39;t know much about speed or memory usage yet, so please don&amp;#39;t yell at me if I said something stupid. T.T</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/3789912246144102939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/3789912246144102939'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292113519728#c3789912246144102939' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-870795946'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-2564441404908387813</id><published>2010-12-11T13:30:40.376-08:00</published><updated>2010-12-11T13:30:40.376-08:00</updated><title type='text'>@royans: with a RandomAccessFile you can seek arou...</title><content type='html'>@royans: with a RandomAccessFile you can seek around freely, no need to reopen the file.&lt;br /&gt;&lt;br /&gt;@Adrien: I always read the code of library functions before calling them from my code.  I know not to trust the JDK especially, because there are a lot of dumb things in it.  I spend a lot of time reading the code of the JDK on Google Code Search, but in this case I also double-checked that the JRE I was using had the problem with strace indeed.  A number of packages in the JDK are very poorly implemented.  Some packages are pretty awesome however, such as everything that Doug Lea wrote (no surprise there) for java.util.concurrent.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2564441404908387813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/2564441404908387813'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292103040376#c2564441404908387813' title=''/><author><name>tsuna</name><uri>http://www.blogger.com/profile/06114951663056205324</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1995837882'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-8304393048352088035</id><published>2010-12-11T09:17:45.048-08:00</published><updated>2010-12-11T09:17:45.048-08:00</updated><title type='text'>Nice history !

How did you dive that deep into re...</title><content type='html'>Nice history !&lt;br /&gt;&lt;br /&gt;How did you dive that deep into readLine() implementation ? Strace ?&lt;br /&gt;&lt;br /&gt;What about readFully() ? Did it also fill the byte array... byte after byte ?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/8304393048352088035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/8304393048352088035'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292087865048#c8304393048352088035' title=''/><author><name>Adrien Mogenet</name><uri>http://www.blogger.com/profile/13887310572024815894</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_usAVPNOHnaM/SiqHRRCzrxI/AAAAAAAAACI/iQH-2adwTmY/S220/photo.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-826247920'/></entry><entry><id>tag:blogger.com,1999:blog-8260739278874294486.post-299421396014023232</id><published>2010-12-11T01:36:47.491-08:00</published><updated>2010-12-11T01:36:47.491-08:00</updated><title type='text'>Wow, thats very interesting (and sort of dumb). Ho...</title><content type='html'>Wow, thats very interesting (and sort of dumb). How expensive is to reopen the file if its huge file, or cache the contents of small files to avoid the &amp;quot;re-seeking start of file&amp;quot; issue.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/299421396014023232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8260739278874294486/9006376620824868081/comments/default/299421396014023232'/><link rel='alternate' type='text/html' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html?showComment=1292060207491#c299421396014023232' title=''/><author><name>royans</name><uri>http://www.blogger.com/profile/16268344104057191288</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_HuNnlRIXLg4/S4qTH0nZhdI/AAAAAAAAUDs/BZcLok5207I/S220/r.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.tsunanet.net/2010/12/java-io-slowest-readline-ever.html' ref='tag:blogger.com,1999:blog-8260739278874294486.post-9006376620824868081' source='http://www.blogger.com/feeds/8260739278874294486/posts/default/9006376620824868081' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-67793261'/></entry></feed>
