On Nov 7, 2006, at 1:03 PM, Perrin Harkins wrote:

I think some of these are a little over-zealous, Jonathan.

oh, they're completely off the hook.  but they work.
BTW, none of my approaches were pre mature optimization. They were all based on profiling code via Apache::Status to get better performance.

There are always trade-offs when using CPAN modules, but when in doubt,
it's a good idea to use them first and then make changes later after
your code is working, if your tests show that one of them is a memory
hog.  File system traversal always sounds easier than it really is, as
is often the case with commonly used CPAN modules.

FileFind, like many cpan modules, is good if you're doing some awkward tasks on a wide variety of platforms. If i made a distributed product or library, i'd use it. But some 'simple' tasks on a known / unchanging configuration are sometimes best kept simple. If i want to get all of the .html files in a path, and all my servers are freebsd, and I only install this app on my servers -- file system traversal is really simple. if i had to support linux or win, then i'd have issues. stripping out file::find saved me 2mb of memory.

Your debug statements take up 40% of your memory?  I don't think that
will be the case for most people.
My own code was about 20. On average a CPAN module was around 40. I tried doing some regex on RoseDB and Petal, which are my biggest libraries. Some modules in each went down 2% (nothing). But other modules went down 60% in size. The difference was between importing all of the random debugging modules and functions into namespace, and just flat-out omitting a lot of logic and strings.

I hardly ever use perl's pseudo-constants. They're more trouble than they're worth, and most apps will not show a significant difference in performance. This is only worth thinking about if you have huge amounts of debugging statements in your code (in which case, maybe you should try using the debugger instead).
or if you have 'intensive' debugging statements in code.

I definitely use them too much myself. I haven't seen any real difference in performance. the only difference i've seen is in memory use. a little over zealousness, and i got another MP2 server AND 50mb more memory for Postgres (which is sadly running on the same box right now, the reason why i had to go crazy ).




// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Reply via email to