Newsgroups: comp.lang.perl.misc,fj.lang.perl,comp.infosystems.www.authoring.cgi
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!tokyonet.ad.jp!tokyonet.ad.jp!tdi-extnews!tdi-rcac!wnoc-kyo-news!wnoc-sfc-news!venus.sun.com!cs.utexas.edu!howland.reston.ans.net!newsfeed.internetmci.com!in2.uu.net!world!aml
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: eval and Speed
Message-ID: <DpwMHo.4JH@world.std.com>
Organization: The World @ Software Tool & Die
References: <4krgge$fn2@sun1.uni-essen.de>
Date: Mon, 15 Apr 1996 12:53:48 GMT
Lines: 18
Xref: galaxy.trc.rwcp.or.jp fj.lang.perl:875
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.perl&nb=875&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

si0015@aixrs1.hrz.uni-essen.de (Olaf Walkowiak) writes:

>Should I avoid the use of "eval" if possible, or doesnt it slow down
>the speed very much?

It depends on whether you mean what the man page calls "eval EXPR" or
"eval BLOCK".

"eval BLOCK" is pre-compiled, like the regular script, and exerts little
run time impact. (less than a subroutine call.) It can be used to trap
runtime errors.

"eval EXPR" has the expression compiled each time it is encountered. It
can have serious security implications, can be very slow (if possible
don't put it in an inner loop, eval the whole outer loop instead.),
and is usually can be replaced more effectively with references.
-- 
Andrew Langmead
