[Gambas-user] Big Gambas3 slowdown on hex edit / compare program

Benoît Minisini gambas at ...1...
Wed Dec 14 19:29:32 CET 2011


Le 14/12/2011 15:59, Caveat a écrit :
> Hi,
>
> I have a program that compares small binary files (either 1k or 4k so
> really quite small files!).
>
> The program builds the GUI based on whether the user has chosen to view
> the data from a Mifare 1k card or a Mifare 4k card.
>
> Problem is that when building the view for the 4k card, the program
> slows down to a crawl.  There are 8192 textboxes built in 2 columns of
> 64 panels (64 textboxes per panel), with a bold label against each panel
> indicating the sector number on the card.  This arrangement represents
> the sectors on a Mifare 4k card.  The side by side column view makes for
> a very nice, quick visual check on where the cards differ.
>
> The slowdown doesn't appear to be linear, that is the more items there
> are to add (or have been added), the slower and slower it gets.  I get
> the impression Gambas may be frantically shuffling things around on the
> form, and finding more and more things to shuffle, so taking longer and
> longer as each item is added.  To see the slowdown for yourself, just
> try selecting Mifare 4k in the dropdown under Mifare Card Type, you
> don't need to load any files or run Compare...
>
> I have tried replacing the whole panel/textbox/scrollview thing with a
> GridView and it works, a LOT faster, but then you have no possibility to
> edit the data (coming in a later version of the program!).
>
> If anyone can take a look and suggest some improvements, I'd be more
> than happy!
>
> Kind regards,
> Caveat
> P.S.  Project is attached, it is a work in progress...!
>

I guess the slowdown comes from Qt or GTK+, as I usually don't use any 
O(n) algorithms in my code.

But using 8192 textboxes is a stupid thing, as GUI are very heavy, in 
any toolkit. So just use a TableView as Fabien said. TableView is an 
editable GridView.

When the user click on a cell, tell the TableView to edit the data with 
the Edit() method. Then the "Save" event will be raised to ask you to 
save the data. You have to maintain the TableView contents yourself 
(through the Data event), as the TableView just displays and edits it.

Regards,

-- 
Benoît Minisini




More information about the User mailing list