in reply to Perl reads minimum 8KB from files. Can this be lowered?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl reads minimum 8KB from files. Can this be lowered?
by sectokia (Friar) on Apr 08, 2022 at 07:24 UTC | |
| [reply] |
by roboticus (Chancellor) on Apr 08, 2022 at 12:55 UTC | |
When reading this thread, I was curious. If perl uses the same block size as the record size in the OS, I'd expect reading short records randomly might be a little faster than reading the default size blocks (due to copying less data into the perl variables). If perl uses a larger block size than the OS, I'd expect that reading smaller block sizes would be significantly faster. So I whipped up a little test case:
When I ran it, I saw this:
Reading small blocks is much faster than reading default-sized blocks. But at this point, I've got to go to work and stop playing with this. I haven't done any research to find out what the default block size is on the OS (Windows 8.1 64b), or used by my perl (v5.30.3 built for x86_64-cygwin-threads-multi). So I don't know if the speed difference is due to block size differences between perl and the OS or perl carving the block up into smaller chunks or whatever. I'll leave that as an exercise for interested parties. (Of course, there's always the small chance that I'll revisit this tomorrow.) The differences are probably due to one or more of the following things I can think of (and probably others that aren't immediately coming to mind):
It might be interesting to try different record sizes and see if there are any inflection points in the timings to get a few more clues, and to help narrow down the reasons. Anyway, thanks for an interesting diversion this morning. My coffee kicked in, and it's time to head into the shower and go to work! ...roboticus When your only tool is a hammer, all problems look like your thumb. | [reply] [d/l] [select] |
by Anonymous Monk on Apr 08, 2022 at 13:17 UTC | |
| [reply] | |