bibledit-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[be] bibledit-git polling


From: Dan Dennison
Subject: [be] bibledit-git polling
Date: Wed, 28 Jan 2009 16:53:13 -0800

I ran bibledit-git through callgrind.

It seems the bulk of its CPU load is in the following while loop, located in ipc.cpp:350:

while ((method_called_type != method) && (time(0) <= (oldtime + timeout))) {
      g_usleep(100);
    }

I need to double-check this on Windows, but it seems to me off-hand that this loop is going to be CPU-expensive regardless of platform. bibledit-git is so expensive CPU-wise on Windows right now that it's hard to recommend for laptop users.

Should InterprocessCommunication::receive() just register a callback with InterprocessCommunication::send() ? It seems like that would really lower the CPU demand while an event-driven solution in bibledit- git.cpp gets worked out.

Callgrind reports that of 7 calls to InterprocessCommunication::receive from bibledit-git's main(), there were 186804 calls to g_usleep from line 350 of ipc.cpp. FWIW, g_usleep is about 10x as expensive as calling time() in the while-loop conditional. (34.30% of CPU in g_usleep() vs. 3.92% CPU in time())

If you want to inspect the results, see https://thedennisons.org/~dand/ callgrind.out.14640.gz Gunzip it, and open in kcachegrind. If you don't have kcachegrind, apt-get install kcachegrind.

dan :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]