I compiled xboard with the -pg CFLAG to build in profiling, ran it (it was slow as usual), and ran gprof on the resulting gmon.out. The result is surprising:
address@hidden:~/Code/xboard/xboard$ head gmon.txt
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
100.00 0.02 0.02 3 6.67 6.67 InitPosition
0.00 0.02 0.00 5944 0.00 0.00 FileGet
0.00 0.02 0.00 638 0.00 0.00 ToLower
0.00 0.02 0.00 263 0.00 0.00 BoolFeature
0.00 0.02 0.00 192 0.00 0.00 ExpandPathName
So apparently it thinks the whole thing only lasted 0.2 seconds. Normally this would imply that it's slow because it's blocking on something, and not using up actual CPU time. To confirm this I ran time on it:
address@hidden:~/Code/xboard/xboard$ time ./xboard
Loading XPMs...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 light square dark square Done.
real 0m13.614s
user 0m0.400s
sys 0m0.396s
That's quite a huge discrepancy -- 13 seconds of real time (that's accurate) but only 0.4 of those seconds were spent in the actual program. (Normally those two numbers are much closer together).
At this point I'd just say the code is blocking somewhere for a very long time -- but this doesn't at all explain why the CPU goes up to 100% and slows down the entire machine during those 10 seconds. That definitely doesn't sound like idle blocking to me.
The only remaining explanation is that xboard is starting up a new process while it loads. I thought it might be an engine, but again, I experience this even with -ics on. So I doubt it's that.
Hopefully one of you guys knows what's going on :)
Thanks!
-Adrian
On Tue, Aug 3, 2010 at 9:40 PM, Adrian Petrescu
<address@hidden> wrote:
Hey guys,
This bug is a bit harder to define. All I know is, the latest version of Xboard from the Ubuntu repository (4.4.2-1) starts up just about instantly, takes maybe half a second. The latest xboard from master on git, however, takes a good 10 seconds on average, during which time the CPU load spikes to 100% and slows down the entire machine. After those 10 seconds it suddenly snaps back to reality and performs perfectly. However, this extremely laggy and intrusive startup is bothering me.
Here are the things I've tried:
- Compiling with and without Xaw3d. No difference.
- Running with and without my custom xpms. No difference.
- Running in and out of engine mode. No difference.
The only thing that seems to make a difference is to go back to the binary shipped with Ubuntu; but I'd prefer to stay with the latest version and help with testing, etc. I've attached my .xboardrc but it looks normal to me; the only change I made is the pixmapsDirectory, but it still happens if I get rid of that too.
Thanks, guys!
-Adrian