From: Paul Brannan Date: 2008-03-27T22:31:31+09:00 Subject: Re: some Enumerable methods slower in 1.9 on OS X after revision 15124 On Thu, Mar 27, 2008 at 02:26:51PM +0900, Nobuyoshi Nakada wrote: > Should the priority be _setjmp > sigsetjmp > setjmp? I think it may depend on the platform. I ran across this the other day while trying to decide whether I could afford the overhead of a call to rb_protect(): http://bugs.opensolaris.org/view_bug.do;jsessionid=3681352170809a64f236f8b6ec?bug_id=4404612 Quote: One of the 'big wins' I discovered was to rebuild perl so that it used setjmp instead of the default sigsetjmp. This gave about an 18% performance boost. It turns out that the perl interpreter calls sigsetjmp every time it enters a new block scope, and the libexacct module does this a lot, which is why the setjmp/sigsetjmp difference is so noticeable. I wrote a micro benchmark to time how long setjmp and sigsetjmp took. Here are the results for sparc (450Mhz): Loop overhead: 22 ns/iter setjmp(jb): 37 ns/call sigsetjmp(sjb, 0): 11774 ns/call sigsetjmp(sjb, 1): 11891 ns/call and here are the results for i386 (600MHz): Loop overhead: 2 ns/iter setjmp(jb): 25 ns/call sigsetjmp(sjb, 0): 1963 ns/call sigsetjmp(sjb, 1): 1975 ns/call mongo$ Linux (laptop 360MHz) gives: Loop overhead: 16 ns/iter setjmp(jb): 101 ns/call sigsetjmp(sjb, 0): 101 ns/call sigsetjmp(sjb, 1): 1288 ns/call It seems there exist platforms where setjmp is preferable over sigsetjmp with the second parameter set to 0. Paul