Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

Lazarus-Dev: Updates to LHelp the CHM help viewer for Lazarus

$
0
0

LHelp is the help viewer that is included with Lazarus to view the chm files usually included in releases.

Some time ago some changes were made so that when F1 is pressed and LHelp is started, LHelp would load several help files such as the Lazarus Component Library(LCL) the Runtime Library(RTL) the Free Component Library(FCL) and several others. This is nice because then it's possible to search all the open files for keywords.

The down side to this is that every time a chm is loaded, the Table of Contents updates and the default page of the help file was rendered. So it was very visible as each help file was loaded in LHelp and not very pretty.

Additions the the protocol used for communication between LHelp and Lazarus, made by Reinier Olislagers, allowed LHelp to load the files while it was not yet visible and then be shown afterwards. This worked well but there was a long delay in the time F1 was pressed and the time LHelp became visible. Almost ten seconds on a modern multi-core desktop computer.

Investigation into the cause revealed a couple of slowdowns. The major cause was the speed at which the IPCServer.PeekMessage routine was polled. Only every 200 milleseconds. Sending commands to open 10 files would take 2 seconds. Also it used the syntax if IPCServer.PeekMessage(5) then ... which was not ideal. Changing this to while IPCServer.PeekMessage(5) do ... allows it to handle another message immediately if one is available.

Another factor was the way that Lazarus looked up the chm files to open. It would collect all files in any folder that could contain a chm file without using a file mask. Adding a mask for *.chm files sped this up significantly.

Speedups in LHelp were implemented by adding BeginUpdate and EndUpdate to the protocol. This allows chm's to be loaded without rendering the default page for each chm as it's loaded. When the last EndUpdate is sent, the final requested help topic is the only one rendered.

All of this results in a startup time of ~2 seconds. A big improvement over 10 seconds. The changes are committed in the svn version of Lazarus and if they are not in the soon to be released Lazarus 1.4 they will be in the following release.



Viewing all articles
Browse latest Browse all 1725

Trending Articles