[OS X TeX] Time penalty when using kpsewhich on mac os x?
jfbu at free.fr
Sat Oct 11 17:10:10 EDT 2014
Le 11 oct. 2014 à 23:02, Adam R. Maxwell <amaxwell at mac.com> a écrit :
> I tried profiling kpsewhich, and it looks like the speed hit
> is almost entirely related to using locks (which getc(3)
> does by default). We ran into this years ago with BibDesk,
> and worked around it by using getc_unlocked(3), which is also
> in POSIX.
> Karl, can kpsewhich be compiled separately from TL? It'd be
> interesting to play with this (assuming it only uses a single
> thread, so getc_unlocked is safe).
> To reproduce this, type the following in one Terminal and
> hit return:
> $ sample kpsewhich -wait -mayDie -e
> In another Terminal, run the kpsewhich command:
> $ kpsewhich -var-value=TEXMFLOCAL
Here is what I get on my MBA under Mavericks
(full log sent to you off-list as it is a bit longish)
$ sample kpsewhich -wait -mayDie -e
Waiting for 'kpsewhich' to appear... kpsewhich appeared.
Sampling process 7941 for 10 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Sample analysis of process 7941 written to file /tmp/kpsewhich_2014-10-11_230645_AByh.sample.txt
Analysis of sampling kpsewhich (pid 7941) every 1 millisecond
Process: kpsewhich 
Load Address: 0x100000000
Code Type: X86-64
Parent Process: bash 
Date/Time: 2014-10-11 23:06:45.444 +0200
OS Version: Mac OS X 10.9.5 (13F34)
Report Version: 7
365 Thread_466167 DispatchQueue_1: com.apple.main-thread (serial)
365 ??? (in kpsewhich) load address 0x100000000 + 0x874 [0x100000874]
365 ??? (in kpsewhich) load address 0x100000000 + 0x12cf [0x1000012cf]
365 ??? (in kpsewhich) load address 0x100000000 + 0xd1e4 [0x10000d1e4]
365 ??? (in kpsewhich) load address 0x100000000 + 0x5b3e [0x100005b3e]
196 ??? (in kpsewhich) load address 0x100000000 + 0x6930 [0x100006930]
+ 187 ??? (in kpsewhich) load address 0x100000000 + 0x93b1 [0x1000093b1]
+ ! 91 getc (in libsystem_c.dylib) + 55 [0x7fff90e7f2f2]
+ ! : 66 pthread_mutex_unlock (in libsystem_pthread.dylib) + 60 [0x7fff91bb18f3]
+ ! : | 39 __mtx_droplock (in libsystem_pthread.dylib) + 268,302,... [0x7fff91bb13ca,0x7fff91bb13ec,...]
+ ! : | 27 OSAtomicCompareAndSwapLong$VARIANT$mp (in libsystem_platform.dylib) + 8,0 [0x7fff8e42cbd4,0x7fff8e42cbcc]
+ ! : 11 pthread_mutex_unlock (in libsystem_pthread.dylib) + 222,8,...
More information about the MacOSX-TeX