Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: assertions in perl5.9.0

by thor (Priest)
on Nov 30, 2003 at 15:22 UTC ( [id://311037]=note: print w/replies, xml ) Need Help??


in reply to assertions in perl5.9.0

Perhaps I'm over-analyzing this, but it seems to me that because perl is an interpreted language, that assertions will provide minimal speed up. When I go to execute a script, perl parses my code, compiles it, and then runs it. From what I understand, an assertion is optimized away at compile time, which (for traditional invocation) happens every time. I suppose the longer running the script, the more benefit there is in something like this. On the other hand, perhaps I'm missing the point completely...:-)

thor

Replies are listed 'Best First'.
Re^2: assertions in perl5.9.0
by Aristotle (Chancellor) on Nov 30, 2003 at 19:06 UTC

    There's certainly a lot of use for this. Perl isn't just used for shell oneliners and quick 10 line munger scripts. mod_perl handlers, daemons written in Perl, and stuff like logfile or DNA sequence mungers that process hundreds of megabytes of input at every invocation will certainly benefit.

    Even without those examples, I like the discipline imposed by assertions. They could be called "executable comments" - the important part being the promise that behaviour will not change at all with assertions disabled. It's like a test suite embedded right in the code.

    Makeshifts last the longest.

Re: Re: assertions in perl5.9.0
by Anonymous Monk on Nov 30, 2003 at 19:32 UTC
    You're not over-analyzing, you're over-simplifying your analysis. Run-time overhead is always more important than compile-time overhead because usually, the run-time of a program is significantly longer than the compilie time.

Log In?
Username:
Password:

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

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

    No recent polls found