Re: A tale of waiting



On Tue, Jun 23, 2009 at 4:16 PM, Benjamin Otte<otte gnome org> wrote:

> Next, I looked, where most of the time is taken. These things were standing out:
>  * Getting the mime type
> Getting the mime type for a file requires opening the file and
> checking the first bytes against the known patterns for files. Both
> operations take time. The mime type also is usually not required.

As Bastien already pointed out, this is just not true. Getting the
mime type does not use sniffing in most cases. /usr/bin is a the worst
case where extension-based mimetype detection breaks down, but it
should do fine in your homedir, unless you are weird.

> Next I implemented sorting. Because I use an array, I can use qsort(),
> which is fast. I had thought about switching to GSequence to get ever
> closer to GtkListStore, but I did not do that, and one of the reasons
> is that GSequence uses insertion sort, which is quite slow.

Not sure why you keep repeating this, it is not true. GSequence is
backed by a balanced tree, so sorting by insertion gives you O(n log
n), so at least asymptotically,
it is fine. The implementation may of course still be slower than qsort().


> And now the obvious question: Should I just merge it to master when
> I'm done with the regressions?

No, of course not. This needs to be reviewed and merged incrementally.
For one thing,
we don't know what other aspects of file chooser behaviour have been
negatively affected by your optimization towards a single goal. Is
scrolling still ok ? Does changing the sort column work reasonably ?
Etc.

The file chooser has already seen too many rewrites...


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