Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: OT: Use Perl wisely and cleverly

by Nkuvu (Priest)
on Feb 22, 2003 at 00:46 UTC ( [id://237641]=note: print w/replies, xml ) Need Help??


in reply to Re: OT: Use Perl wisely and cleverly
in thread OT: Use Perl wisely and cleverly

It's not completely out of date. We do, after all, have limited RAM, HD and CPU to execute our programs. I could probably implement something that is very inefficient very easily. We want to pay attention to the speed, but we don't want to dwell on it (to the point of micro-optimization) or consider it the final word in language merit.

I could write a script that slurps things into a linear array and do a painful linear search every time I want to see if an element exists. Or I could use a hash to do the same thing in much less time...

  • Comment on Re: Re: OT: Use Perl wisely and cleverly

Replies are listed 'Best First'.
Re: Re: Re: OT: Use Perl wisely and cleverly
by John M. Dlugosz (Monsignor) on Feb 22, 2003 at 05:46 UTC
    Limits: Well, the engraving I did on another thread of TheDamian's code took 8 hours of CPU time on a 1.2 GHz processor. That would have been a rediculous amount of CPU usage and RAM just a few years ago.

    Back when I first did ray-tracing, I was using a 80286 with no floating point hardware! One time somewhere between that at the '486SX days I wondered about doing a hand-coded machine language version. The response from the group was that it was a waste of time; effort would be better spent on algorithm improvements than on non-portable and probably not maintainable issues.

    In my real work, I feel that using an O(n2) algorithm is "wrong" if you can do it n log(n). That is, don't go out of your way to make it super efficient, but don't do something stupid either.

    As for the ray-tracing, I think it was so slow because the objects generated from truetype font extrusions are not set up with simple bounding boxes. If I expanded that project, I would look at putting simple boxes around each line of text to early-out a non-intersection.

    But it won't stop me from wishing for a faster CPU, or wishing that the program were designed with efficiency in mind in the first place, with respect to the data structures used.

    —John

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-18 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found