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

[PATCH] Tie::File 0.94

From:
Tels
Date:
April 13, 2003 11:22
Subject:
[PATCH] Tie::File 0.94
Message ID:
perl.perl5.porters-74197@nntp.perl.org
-----BEGIN PGP SIGNED MESSAGE-----

Moin,

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

        http://bloodgate.com/perl/packages/devel/

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

This is a followup to:

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-03/msg00022.html

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
          others.

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,

Tels



- --
 http://www.notcpa.org/ You still can run any code on your CPU. How long?
 Signed on Sun Apr 13 20:24:11 2003 with http://bloodgate.com/tels.asc

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

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

iQEVAwUBPpmr7XcLPEOTuEwVAQHYnQf+LnstVqrOkVbF9V0IBSrx8tgVrpF0L0Qs
8K7hBx9Ong+K1u140/nVkHYWCSMlTu+ozcmpnUwVLcszk0fYikCFAr+BNhML9Dqq
WvxFca2Dp91ia/yNhWIfn9jAVq9lFVHSyJeKRkk256hSE+VWi57nQ4T0t6Sy/UzU
4P4HLOvllzl0icSH8KCzmke29g8+0pMCdE4RVYK4VfSOfn8ASOJMo0PdKsmNVFqz
qVaPmgMOoyrL58TobWneaWTyy3e4xFWY23HEeAsqIxo9VarlTu43yTo8js5vjj1d
5OZL3v2ucjVWvZZWRmjaWiOUliWeIchPfTsX6arlDIgenMhEwGHRLg==
=/Vng
-----END PGP SIGNATURE-----



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About