[
Lists Home |
Date Index |
Thread Index
]
Karl Waclawek scripsit:
> Not compared to exceptions. Memory allocation and deallocation
> is very expensive across most languages. You can alleviate this somewhat
> with a smart garbage collector, but only to a degree.
Since an AllDoneException is basically stateless, you can employ a singleton
and bury the cost of allocating it in the general startup overhead.
> I think I said something about using status in low level code
> and leave the decision about exceptions to high level code
> with sufficient context to make it.
You did, but low or high, return codes are a botch.
> I can whip up a quick demo in Delphi
> (I already did - took 5 minutes) which shows that passing a Boolean result
> up from a 5 levels deep nested procedure call executed in a loop is at least
> 100 times as fast as throwing and catching an exception for the same purpose.
A newly allocated exception, as I suppose. It should be quick to determine
the numbers for a singleton exception, too.
But fundamentally this is a benchmark, and execution speed on a benchmark
is no indication whatever of execution speed of a full application running
on live data.
--
John Cowan http://www.ccil.org/~cowan cowan@ccil.org
To say that Bilbo's breath was taken away is no description at all. There
are no words left to express his staggerment, since Men changed the language
that they learned of elves in the days when all the world was wonderful.
--_The Hobbit_
|