❌ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdayNews from the Ada programming language world

AZip, GWindows, the Windows API and another surprise!

13 November 2022 at 12:38


Note for subscribers: if you are interested in my Ada programming articles only, you can use this RSS feed link.

Last post was about an improvement of the GWindows.Common_Controls.Ex_List_View widget which is distributed with the GWindows framework. Without changing the specification, it was possible to avoid Windows API calls during the performance-sensitive comparison function, leading to impressive speedup factors: from 3.3x with 4096 items to 16.5x with 32768 items.

But actually, it was only the prelude!

If you can live with data duplication, which is not nice and not always practical, it is possible to do much better. Concretely, you store the same strings in the cells of the List_View widget and in the payload data associated with each row. Then, the sorting for all columns (text, dates, numbers, ...) is using the payload data. An addition to the Ex_List_View package later (this time, enriching a bit the specification), the comparison function may exclusively use the payload of both compared rows, directly, thus avoiding any API call during the lifespan of the comparison function.

Without going into too many details, here are the performance gains in charts:

This represents a factor of ~100x to ~300x on top of the previous improvement, depending on the test machine.

Here are links to the sources:


Project site & Subversion repository:
GitHub clone with Git repository:


Project site & Subversion repository:
GitHub clone with Git repository:

AZip, GWindows, the Windows API and a good surprise!

5 November 2022 at 21:23

Note for subscribers: if you are interested in my Ada programming articles only, you can use this RSS feed link.

Programming user interfaces is often a bizarre experience where you program only one side and the other side is done by other people (for instance the programmers of the Windows components) that you cannot contact for asking questions. Even if it was possible (like working at Microsoft in Redmond), those people are probably already retired for long. So the only possibility is to experiment with the black box and skim the Internet in the hope someone else has encountered the same issues and found a solution. Fortunately, as time goes by, there are more and more solutions appearing.

Here is a typical example.

The AZip Zip archive manager is designed to operate with different user interface systems, like native Windows (it is done through the GWindows framework), or the multi-platform Gtk system (there is a draft version of that).

AZip uses the Ex_List_View_Control_Type widget (package GWindows.Common_Controls.Ex_List_View) which is an extension of List_View_Control_Type (package GWindows.Common_Controls), developed by the company KonAd GmbH, with cool features like individually coloured cells, and sorting.

A hiccup was the performance of the sorting. On Zip archives with many entries (say, 10,000 or more), the sorting became frustratingly slow. On other software sorting is MUCH faster, so there was an issue to solve.

Sorting a column in AZip - click to enlarge screenshot

Fortunately GWindows and its extensions are completely open-source, so you can inspect everything. By the way, it is also the case for GNAT (the open-source Ada compiler): you can inspect the entire run-time library. All in all, AZip is a rare software whose entire source (the program itself, the user interface, the data compression library, and the run-time library) can be comfortably browsed per mouse clicks from GNAT Studio. This amounts to more than 112,000 and 572 units (mostly packages), completely in Ada. You see here a slide from a FOSDEM presentation about AZip.

Break-down of the Ada source code of AZip

Wait, the "entire source"? Not really, since Windows is neither open-source, nor in Ada. That's where the fun begins. Back to our sorting issue (sorting is too slow). GWindows (the nice object-oriented framework) provides a Sort method, which sends behind the scenes a Windows message, LVM_SORTITEMS, which calls back a comparison function provided by GWindows, Compare_Internal, which in turn will calls a On_Compare method - built-in, or derived by the programmer, for instance for sorting the columns of a Zip archive where some columns are numerical and other ones are texts. This mechnism is convoluted but it is how it works if you want to use the List_View widget provided by Windows. It is a case where you really have to dance with the Windows API (of course, you would have the same situation for other user interface systems: Mac, Gtk, ...). After a certain amount of Internet searches, through forums, blogs, etc., it appears that there is an alternative way with a Windows message called LVM_SORTITEMSEX. Note the "EX" at the end: it is for "extended". You have probably noticed rather the last three letters, but anyway... This alternative way provides directly to the comparison call-back the indices of the rows that Windows want to compare. With the initial approach (using LVM_SORTITEMS, without EX) two messages, LVM_FINDITEM, have to be sent in order to get those row indices. So you can save those two calls and hope for a small speedup.

Now comes the surprise. The gain in terms of time is astounding!

On a certain computer, with 4096 items to be sorted, both calls (that can be skipped with the new approach) consume 70% of the entire sorting time - including the comparison itself, the sorting effort on Windows' side, the object-oriented dispatching, etc. . With 8192 items, it is 81%. With 16'384 items, it is 88%. With 32'768 items, 94% of the time is consumed by the extra calls. Seen differently, the old approach takes 14 seconds for sorting, and the new approach takes 0.85 second for the same job!

Here are performance charts on two differents computers.


Interestingly, the performance stays linear with the new approach.

Here are links to the sources:


Project site & subversion repository:
GitHub clone with git repository:


Project site & subversion repository:
GitHub clone with git repository:

AZip 2.40 - Windows Explorer context menus

3 October 2020 at 18:00

New release (2.40) of AZip.

The long-awaited Windows Explorer integration is there:

Context menu for a file

Context menu for a folder

This integration is activated upon installation or on demand via the Manage button:



This new version is based on the Zip-Ada library v.57 and includes its recent developments.


AZip in action for duplicating a Thunderbird profile

18 September 2020 at 07:16

You want to copy your Thunderbird profile from machine A to machine B (with all mail accounts, passwords, settings, feeds, newgroups, ...) ? Actually it is very easy. From the user storage (on Windows, %appdata% (you get there with Windows key+R and typing %appdata%)), you copy the entire Thunderbird folder of machine A to the equivalent location on machine B, and that's it. The new active profile will be automatically selected since the file profiles.ini will be overwritten on the way.

Now, if you want or need to use a cloud drive or a USB stick for the operation, it's better to wrap everything in a Zip file (a single file instead of hundreds) to save time. Plus, you can store the Zip file in case of an emergency (losing data on both A and B machines).

With AZip, it's pretty easy:Β 

  • Shut down Thunderbird on both machines.
  • On machine A: drag & drop the Thunderbird folder on an empty AZip window.
  • Copy or move the Zip file.
  • On machine B: extract everything with another drag & drop,Β from AZip to the Explorer window with the %appdata% path. When asked "Use archive's folder names for output", say "Yes". When asked "Do you want to replace this file ?", say "All".

That's it!

Here a few screenshots:

Folder tree view - click to enlarge

You can squeeze the data to a smaller size (the LZMA format will be most of the time chosen over Deflate) with the "Recompress" button (third from the right).

After recompression - click to enlarge

New GitHub mirrors

17 September 2019 at 08:32

New GitHub mirrors, for open-source projects I'm administrator or developer of, are located here.
Please ignore the old mirrors that relied on svn2github. If you see "svn2github" somewhere on a repository address, it's the old one β†’ trash it!

You can find the same projects on SourceForge too, here.

The projects are...

Ada Bar Codesbar code (1D and 2D) generator in pure Ada
Ada PDF Writera standalone, portable package for producing dynamically PDF documents
AZipa free, portable Zip Archive Manager
Corporate Bullshit Generatorthe Corporate Bullshit Generator
Engine_3Da real-time, pure software, 3D engine for DOS-talgics
Excel Writera standalone, portable Ada package for producing Excel spreadsheets
GIDGeneric Image Decoder
GLOBE_3Da real-time 3D Engine written in Ada
GNAVI: GNU Ada Visual Interfacethe GNU Ada Visual Interface
GNOGAthe GNU Omnificent GUI for Ada
HACHAC Ada Compiler
Ini file managera standalone, portable Ada package for configuration files
LEALightweight Editor for Ada
Mathpaqscollection of mathematical, 100% portable, packages in Ada
Pascal-to-AdaPascal to Ada translator
TeXCADa program for drawing or retouching {picture}s in LaTeX
Wasabeea Web browser with safety focus
Zip-Adaa standalone, portable Ada library for Zip archives

AZip 2.35

3 August 2019 at 17:29
New AZip features since v.2.25:
  • Select columns menu entry allows you to select the columns that you find useful to be displayed (v.2.30)
  • Option for a default extraction directoryΒ (v.2.31)
  • Drag & Drop from a folder within AZip, to Windows Explorer or to the DesktopΒ (v.2.35)
  • Context menus within AZipΒ (v.2.35)
Visit AZip home page here.

Column selection - click to enlarge

Option for a default extraction directoryΒ - click to enlarge

Context menus with AZipΒ - click to enlarge