[Cython] CF and finally clause

Robert Bradshaw robertwb at math.washington.edu
Wed May 25 01:30:12 CEST 2011


On Tue, May 24, 2011 at 2:17 PM, Carl Witty <carl.witty at gmail.com> wrote:
> On Tue, May 24, 2011 at 2:04 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> I'm not so opposed to this proposal. I have been (idly and unfoundedly)
>> wondering basically forever if the current way try-finally is implemented is
>> actually a good one. I can accept a performance penalty for the exception
>> case in both try-finally and try-except, but the normal case in try-finally
>> should run as fast as possible. I'm not sure the C compiler can always
>> detect what that "normal" case is in order to properly optimise for it.
>
> Evidently Java compilers duplicate the finally block (or, actually,
> triplicate it):
>
> http://cliffhacks.blogspot.com/2008/02/java-6-tryfinally-compilation-without.html

Interesting...

I don't like the idea of copying code all over, Stefan makes some good points.

- Robert


More information about the cython-devel mailing list