Re: Aggressive exception handler making extra work for itself.
Dave Rolsky <[email protected]> Mon, 19 Mar 2007 18:38:57 -0500 (CDT)
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 19 Mar 2007, Jesse Vincent wrote:
> So, $m->comp defines a SIG{__DIE__} handler. Inside Jifty, we make
> relatively heavy use of our own microexceptions (trivial eval blocks). What
> this means is that every time we call eval {} from within code that's called
> by mason, we generate the overhead of a fairly deep Devel::StackTrace. Is
> there some bit of doc I'm missing about how not to hurt myself badly?
I think you mean exec() defines a signal handler, right?
The main reason we do this is we want to ensure that errors are turned
into exception objects, because we use that object and the stack trace
object to display the nice error page.
One possible solution might be to not mess with $SIG{__DIE__} when
error_mode is set to fatal. Would that help Jifty? I'm assuming that on a
production site you'd set error_mode to fatal, so you'd get the speed
benefit there.
Also, could Jifty throw it's micro-exceptions as something other than a
string? Mason will simply rethrow a reference if it gets one, so you could
do something like do:
die { micro => 'foo' };
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV