Re: [perf-discuss] Performance problem with nrand48()

2008-06-27 Thread Andrew C. Henle
This appears to be the implementation: http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/drand48.c In that code, it looks to me like nrand48() locks the mutex and then calls _nrand48_u(), an internal function. The _nrand48_u() function saves the global data, copi

[perf-discuss] Performance problem with nrand48()

2008-06-03 Thread Zeljko Vrba
The disassembly of the nrand48() routine (Solaris 10, AMD64) shows that it is protected with a call to the lmutex_lock routine. Replacing the nrand48() call with a call to my own random-number generator (with per-thread private state) shaves off 33% of running time just with two threads. Since