Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Doubt about fly-weight objects.

by Anonymous Monk
on May 17, 2005 at 16:18 UTC ( [id://457883]=note: print w/replies, xml ) Need Help??


in reply to Doubt about fly-weight objects.

You can avoid adding your own caching by using Memoize: use Memoize; memoize('new'); This wraps your constructor with a caching version. It may not be faster, but the resulting code is cleaner.

Replies are listed 'Best First'.
Re^2: Doubt about fly-weight objects.
by blazar (Canon) on May 17, 2005 at 16:50 UTC
    I do know about memoize. It must have been one of the very first modules I ever discovered - I seem to remember having read about it in an article. Generally I prefer to do memoizing by myself: don't know why and couldn't give any good reason - generally I'm not terribly concerned about efficiency, especially micro-optimization-wise.

    I must admit, however, that for some other reason I couldn't say, I had never thought of using it on (subs called like) methods.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://457883]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found