develooper Front page | perl.perl5.porters | Postings from January 2001

Does perl really need to use sigsetjmp? (18% performance hit)

Thread Next
Alan Burlison
January 8, 2001 06:10
Does perl really need to use sigsetjmp? (18% performance hit)
Message ID:
Here are some test timings of a perl script & XS module that consists
largely of object and tied array creation and destruction:

Built with sigsetjmp:
real    0m33.42s
user    0m28.98s
sys     0m3.94s

Built with setjmp:
real    0m27.23s
user    0m27.07s
sys     0m0.15s

That is a 18% speedup.  Here are the timings per call for Solaris of
setjmp and sigsetjmp:

setjmp: 35 ns/call
sigsetjmp: 11912 ns/call

The reason that sigsetjmp takes so much longer is that it saves the
process' signal disposition (and on Solaris the scheduling parameters
too), and to do this requires a system call.  setjmp on the other hand
works entirely in user land, and is therefore much faster.

Do we really need to use sigsetjmp?  Wouldn't a setjmp suffice?

Alan Burlison

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About