develooper Front page | perl.perl5.porters | Postings from April 2003

[PATCH] Tie::File 0.94

April 13, 2003 11:22
[PATCH] Tie::File 0.94
Message ID:


two patches attached, one against 18376 (bleed) and 19041 (maint). Sorry,
couldn't find a more recent bleedperl snapshot. However, there weren't any
changes in the past to Tie::File, so this should be fine.

A CPANable package of Tie::File 0.94 can be found at

- - of course it should be signed by mjd's key, and not mine :)

This is a followup to:

and merely adds doc, tests and testsuite enhancements to the aforementioned
already done work.

All in all, the patch does the following:

        * bump the version
        * add the method offset() to get offset of record N
        * doc for this, and tests (t/42_offset.t)
        * make the testsuite strict safe
        * put more stuff into the TODO list
        * limits the default cache to 1/4 MB, instead of 2 MB to guard
          against running out of memory due to the high per-cached-record
          overhead (about 310 bytes per entry...)
        * documents (per cache enty/per record) memory overhead
        * fixes small typos and adds some comments to the (already very
          good documented) code
        * reduces the per-record memory overhead from 25 to 21 bytes (on 32
          it Perl under linux, not sure how much is saved on other systems)
        * makes the FETCHALL method over factor 10 faster (it is used when
          you do $i = scalar @tied_file; or foreach (@tied_file))
        * streamliens the other methods, especially FETCH and cache related
          stuff. Result is about 10% more performance for FETCH, among

The patch is only concerned with _reading_, however the benchmark file from
mjd, which benchmarks _writing_ also benefits, which shows that the
performance improvements are relevant in the praxis.

In a test with a file containing over 1.3 million short (avg 8 bytes)
records, the time for a FETCHALL goes down from 1 min 20 to about 8
seconds, which was the primary reason for this patch.

There is still something to do, but this get's the ball rolling. Please
apply to both maint and bleed. I haven't heard _anything_ back from mjd,
but we can later nudge the author into releasing this to CPAN (I wouldn't
even minding maintaining it, if bush comes to shovel, er push to shove or
someone just aks me).

I haven't heard any objections so far, and all tests still pass.

If the patch get's applied, I would be tempted to do more work on the
(already very good and usable) Tie::File module (*nudge nudge wink wave
grin*) - it is certainly better to stand on the shoulders of giants, than
to re-invent the coffee pot.

Best wishes,


- -- You still can run any code on your CPU. How long?
 Signed on Sun Apr 13 20:24:11 2003 with

 perl -MDev::Bollocks -le'print Dev::Bollocks->rand()'
 autoschediastically revolutionize open-source materials

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.

-----END PGP SIGNATURE----- Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About