Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Re: Favourite modules April 2003

by mirod (Canon)
on Apr 15, 2003 at 18:53 UTC ( #250645=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Favourite modules April 2003
in thread Favourite modules April 2003

The function I memoize gets passed a file name, slurps the file, normalizes spaces and computes its MD5. So I don't think the content of the file is cached, as it is internal to the function.

I agree that using Memoize only saves me the cost of a hash (filename => MD5). I just like how easy it is to use it, and how it removes some extra code. As programers we are used to adding extra data structures and code to cache that kind of result, but really, using Memoize gets us closer to the initial algorithm for solving the problem. At least that's how I justify using it here ;--)

  • Comment on Re: Re: Re: Favourite modules April 2003

Replies are listed 'Best First'.
Re: Re: Re: Re: Favourite modules April 2003
by cees (Curate) on Apr 16, 2003 at 04:27 UTC

    That makes more sense. Memoize will only cache the arguements to the function, and the return value so you are fine with your implementation. Sorry for jumping on this, but I thought that you might be doing something like the following:

    use Digest::MD5 qw(md5); use Memoize; memoize('md5');

    This would use gobs of memory (depending on the input) and wouldn't really accomplish anything useful.

    Do I get an award for coming up with the most unproductive use of Memoize???

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://250645]
help
Chatterbox?
[Corion]: In the same vein I have a script that automates Firefox to enter some data into another system. It's not faster than the people using the script if they were to do it manually, but they prefer not having to check the data and not having typos when ...
[Corion]: ... entering the data
[Corion]: Discipulus: I don't know whether I could really do that, but the init process itself mostly launches other processes, and the whole startup is just following a path of dependencies and making sure they are all running. Which basically is what ...
[Discipulus]: when at work my time is (temporarly) owned by the firm, so i do not care (coworkers whatch movies.. I code Perl)
[Corion]: ... make already does, except for files instead of programs. But maybe with some /proc hackery, that could be eliminated and one could use plain make :-D
[choroba]: systemd just makes is asynchronous
[choroba]: so, make -j
[Corion]: Discipulus: Yeah - but when writing Perl to save time (instead of having fun), it helps to look whether you're actually saving time ;) Why spend 5 minutes doing manually what you can spend three years automating? ;)
[Corion]: choroba: Oh, yeah :-D

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-07-27 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (408 votes). Check out past polls.