Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Why it takes so much time here?

by flexvault (Monsignor)
on Dec 29, 2011 at 15:29 UTC ( [id://945516]=note: print w/replies, xml ) Need Help??


in reply to Why it takes so much time here?

Hello PerlOnTheWay,

I read your question yesterday, and my first response was "why would anyone do that?". Then I read the responses and skipped to another RAT.

But after thinking about your question, I realized that your trying to do "C" like things in Perl. I did the same from 1995 to 2001 (approx). But sometime after that I started to "think in Perl". I only speak one language, but I have heard from others that if you want to understand a spoken language, you have to think in that language.

Well, I believe that's true of programming languages as well. If you want to be a Perl programmer, you have to think of how to best solve the problem in Perl.

In 2015, I'll be a programmer for 50years. Most of that time without Perl. My first program was written on a computer with 4,096 words and only 16 instructions and 2 registers. No multiply and no division and no branch(now 'goto'). But you would be amazed at the things we got done.

Why I'm commenting, is that you're got both 'C' and 'Perl' and 7GB of memory. Perl's strengths are numerous. Did you look at 'vec'? Maybe your problem could have been solved differently?

But what I'm trying to explain; Is don't compare Perl to the strengths of 'C'. Solve real problems with Perl and use the strengths of Perl for your benefit.

Now off my soapbox, some comments about your code:

  • start using 'use Time::HiRes qw( gettimeofday usleep ... );'

If your code looked like this (not tested):

use Time::HiRes qw( gettimeofday ); my $stime = gettimeofday; . . . print "Time taken: ",gettimeofday - $stime," seconds\n";
No one would have asked you "...how did you get that time?", it would have been obvious. Try having a skeleton program with key modules and commented examples. Each time you solve something unique, add anything new to your skeleton program. Years from now, it'll save hours of looking for something you know you did before.

And the extra benefit, you'll look like a hero to future management when they comment on "...how quickly he gets the work done!".

Good Luck and keep learning about Perl.

"Well done is better than well said." - Benjamin Franklin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-26 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found