On Tuesday 22 April 2008 19:43:04 Antonio Cuni wrote:
> Jon Harrop wrote:
> this is not a good benchmark, for two reasons:
>
> 1) you are allocating a new object at every loop, but we are
> benchmarking the loops, not the garbage collector :-); you should use
> static methods instead, IMHO;

Actually I tried hoisting the allocation of "test" and it makes the code 
consistently slower. I have no idea why.

> 2) you are allocating a new exception every time; the optimization
> described here [1] works only if the exception is pre-allocated.
> [1] http://blogs.sun.com/jrose/entry/longjumps_considered_inexpensive

I think that is not thread safe. Specifically, when the branch conveys 
information (passed as arguments using a tail call, or embedded in the 
exception) then you must use a locally allocated exception, right?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to