ASCII mode file reading microbenchmark

1 view
Skip to first unread message

Jon

unread,
Nov 1, 2011, 10:35:46 AM11/1/11
to theco...@googlegroups.com
Some very early results (non RAMdisk based) from using the measurements repo on my Win7 32bit and Arch Linux (on VirtualBox). I'm reviewing both the benchmark runner and microbenchmark workload code to convince myself they're valid. Please do the same.

These results are from reading a 500,000 line, LF delimited file three times using `File.open('...', 'r')`



Here's the result from running Arch on my Win7 32bit via VirtualBox. IIRC, on *nix the reads will be performed in binary mode regardless of `File#open` setting. If true, this Linux result should probably be compared with Windows via `rci bench core_brd_filelines_lf`. However, since a user would not typically modify (a la C #ifdef) their Ruby to use 'r' when running on Linux and 'rb' when running on Windows, this comparison is still valid.

[jon@archee measurements-git]$ ./rci bench core_rd_filelines_lf
ruby 2.0.0dev (2011-10-31 trunk 33590) [i686-linux]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf   0.880000   0.030000   0.910000 (  0.908138)
----------------------------------------------- total: 0.910000sec

                           user     system      total        real
core_rd_filelines_lf   0.930000   0.030000   0.960000 (  0.959682)


For reference, here's the binary read performance on my 1.9.3-p0; about the same as Linux:

C:\projects\measurements-git>rci bench core_brd_filelines_lf
ruby 1.9.3p0 (2011-10-30 revision 33569) [i386-mingw32]
Rehearsal ---------------------------------------------------------
core_brd_filelines_lf   0.780000   0.171000   0.951000 (  1.036060)
------------------------------------------------ total: 0.951000sec

                            user     system      total        real
core_brd_filelines_lf   0.843000   0.156000   0.999000 (  1.003057)



And here are the results from running different Rubies on my Win7 32bit:

C:\projects\measurements-git>pik run rci bench core_rd_filelines_lf
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) Client VM 1.7.0_01) [Windows 7-x86-java]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf   8.600000   0.000000   8.600000 (  8.576000)
----------------------------------------------- total: 8.600000sec

                           user     system      total        real
core_rd_filelines_lf   8.512000   0.000000   8.512000 (  8.512000)



ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf   1.826000   0.218000   2.044000 (  2.084764)
----------------------------------------------- total: 2.044000sec

                           user     system      total        real
core_rd_filelines_lf   1.888000   0.172000   2.060000 (  2.068263)



ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf  18.268000   0.062000  18.330000 ( 18.333328)
---------------------------------------------- total: 18.330000sec

                           user     system      total        real
core_rd_filelines_lf  18.034000   0.031000  18.065000 ( 18.084296)

ruby 1.9.3dev (2011-10-11 revision 33457) [i386-mingw32]



ruby 1.9.3p0 (2011-10-30 revision 33569) [i386-mingw32]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf  16.863000   0.062000  16.925000 ( 16.932150)
---------------------------------------------- total: 16.925000sec

                           user     system      total        real
core_rd_filelines_lf  16.677000   0.063000  16.740000 ( 16.780130)



ruby 2.0.0dev (2011-10-31 trunk 33590) [i386-mingw32]
Rehearsal --------------------------------------------------------
core_rd_filelines_lf  16.972000   0.094000  17.066000 ( 17.094170)
---------------------------------------------- total: 17.066000sec

                           user     system      total        real
core_rd_filelines_lf  16.973000   0.047000  17.020000 ( 17.045164)



Jon

---
twitter: @jonforums

rogerdpack

unread,
Nov 1, 2011, 2:34:13 PM11/1/11
to TheCodeShop
Results are a bit mangled maybe you can put it into a gist?

I had once thought it would be nice to overwrite the default MRI I/O
with some hand-brewed windows friendlier stuff... :P

Jon

unread,
Nov 1, 2011, 2:42:45 PM11/1/11
to TheCodeShop
On Nov 1, 2:34 pm, rogerdpack <rogerdp...@gmail.com> wrote:
> Results are a bit mangled maybe you can put it into a gist?

...switching the web view to use fixed font.


> I had once thought it would be nice to overwrite the default MRI I/O
> with some hand-brewed windows friendlier stuff... :P

hehehe...no comment.

Jon

unread,
Nov 1, 2011, 2:59:33 PM11/1/11
to TheCodeShop
> > Results are a bit mangled maybe you can put it into a gist?
>
> ...switching the web view to use fixed font.
>


my IE9 (surprisingly) doesn't pay attention to Google's settings....

http://pastie.org/2794875

Roger Pack

unread,
Nov 1, 2011, 3:18:35 PM11/1/11
to theco...@googlegroups.com
Also interesting is (I think) you get the same poor slowdown when you specify in Linux
File.open(filename, 'ra') or the like.
-r
Reply all
Reply to author
Forward
0 new messages