Very slow 'adding' files

Bug #272859 reported by Adolfo González Blázquez
4
Affects Status Importance Assigned to Milestone
pyRenamer
Fix Committed
Medium
Adolfo González Blázquez

Bug Description

When you change to a directory, the program is very slow 'adding' files until it shows them. What is doing the program in this case? Why is it so slow? Is this problem caused to avoid duplicated names?
Thanks. Your program is wonderful!

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

I've opened a bug for this issue.

Do you have "add files recursively" enabled?

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

No, i don't.
The options I have are:
- Only files
- Pattern *
- The rest of options are off

Revision history for this message
Adolfo González Blázquez (infinito) wrote : Re: [Bug 272859] Re: Very slow 'adding' files

Well, I'm not sure what's going on.

I'm going to prepare a version of pyrenamer with debugging options
enabled and send it to you to see if we can address this bug, as I can't
reproduce this in my system.

I think tomorrow it will be ready.

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

OK. As soon as I can test it, I'll answer you. Thanks.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Could you please try this from a terminal?

$ svn co http://svn.infinicode.org/pyrenamer/branches/pyrenamer-0.6.0-dbg
$ cd pyrenamer-0.6.0-dbg
$ ./autogen.sh --prefix /usr
$ make
$ sudo make install

And then run pyRenamer from the terminal:
$ pyrenamer > pyrenamer_log.txt

And attach here pyrenamer_log.txt (not pasting, attaching).

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Humm, i've made a mistake. To get the log, run pyrenamer with this command:
$ pyrenamer &> pyrenamer_log.txt

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Well, I have needed to install a lot of dev packages in order to make the program. Here is the dbg file.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Wow, really weird. Could you please tell me which distro are you using, as well as gtk, pygtk versions?

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

I've made a change in the code, which maybe fixes this bug. Could you please update the code again (the above commands from comment #5 will work) and attach the log again? Thanks!

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Well. I'm afraid the problem is still there.

I'm using:
- Ubuntu 8.04
- GTK (libgtk2.0-0 package) 2.12.9-3ubuntu4
- pygtk (python-gtk2 package) 2.12.1-0ubuntu1

I think that the problem is not the progress bar.
Thank you for your time.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Could you please try again? Maybe the problem is related to the structure that stores the data for the treeview... I've changed the gtk.TreeStore (bad choice i've made, don't know why) for a gtk.ListStore, which is supposed to be faster....

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Hummm, in my system it makes a very little difference...

<code>
gtk.ListStore
 17 files time 0.0432889461517
 10566 files time 32.2463400364

gtk.TreeStore
 17 files time 0.0469448566437
 10566 files time 34.4815001488
</code>

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Yes. In my system the difference is very little too. The problem persists.

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Well, I have seen that the delay is in 'get_icon' function. If I comment out this function, the program reads the directory immediately.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Hummm, are you using GNOME or KDE or any other desktop?

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

I'm using GNOME 2.22.3

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Could you please try again getting the debug version from svn? I've added some debug info for the get_icon function, to see if we can find the culprit.

Anyway, THANK YOU VERY MUCH for helping with this bug.

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Here you have new log file.
By the way: where are showed these icons? I can't seen them in any place.

Not at all. Thank you for your time. This is a VERY VERY little contribution.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

I'm not really sure what's the problem... This function is supposed to show an icon left to the filename, showing if it's a text file, music, video, etc.

Ok, let's try to get into this. Could you please try to edit line 1570 of src/pyrenamer.py to this three options (one each time, and compile, run) to see if any is working for you?

icon = icon_theme.load_icon(mime, gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_NO_SVG)

icon = icon_theme.load_icon(mime, gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_FORCE_SVG)

icon = icon_theme.load_icon(mime, gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_USE_BUILTIN)

Changed in pyrenamer:
status: New → Confirmed
assignee: nobody → infinito
Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

No. Four options (these three and previous) do the same.
I can't see the icon. I send you a screenshot with one text file and no icon left to the filename.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Well, I've just selected that icon theme and now I can reproduce the bug in my machine, so I can try to fix it here. It seems that when load_icon can't find the appropriate icon, it takes about 2 seconds to give an error....

Thanks again!

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Btw, if you change you're theme to some "complete" theme like Tango, gnome, Human, etc., you will find that pyrenamer works ok.

Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Yes, you're right. I've changed to Human set of icons and it works very quickly.

Thanks again. I'll wait for your news.

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

Well, this is a problem related to how gtk loads icons from themes. If you are using a theme with is not well formed, ie, it has very big icons (256x256), it takes one or two seconds to render the icon to a small size to display it on pyrenamer. This can sometimes be avoided running "gtk-update-icon-cache -f -i . " on the theme folder.

In this case, the ElementaryUbuntu theme should be fixed to provide icons for small sizes, which actually doesn't.

I've made some changes to the code, which should speed the icon loading. But if you're still using a bad icon theme, you will se how pyrenamer takes about 8 seconds or so to start. I will try to sort this out, althought i still don't know why.

Anyway, could you try the svn trunk code now?

$ svn co http://svn.infinicode.org/pyrenamer/trunk/pyrenamer
$ cd pyrenamer-0.6.0-dbg
$ ./autogen.sh --prefix /usr
$ make
$ sudo make install

Changed in pyrenamer:
importance: Undecided → Medium
status: Confirmed → In Progress
Revision history for this message
Juan Pablo González Riopedre (riopedre) wrote :

Well, I can see you're loading five default icons of files and the directory icon on startup instead of loading them for each element in a directory.

You're right. The program takes a few seconds to start. But reading the directory is very fast now.
I can't see small version of the icons. I only can see one small point instead of the icon.

Perhaps we can expect than if there is no icon for a specific type, there are no icons for the rest of the types. This could make start of the program faster.

Thanks!

Revision history for this message
Adolfo González Blázquez (infinito) wrote :

The problem is that gtk+ returns an empty (or very small) icon. It doesn't return null, so there's no easy way to know if the icon is not correct. In fact, with ElementaryUbuntu (which is a very buggy theme) it loads this file ~/.icons/ElementaryUbuntu/256x256/mimetypes/text-x-generic.png

Maybe GNOME/GTK+ should have a way to discover if a theme is incomplete or buggy, and not allow to use it.

So, by now, I think the bug in pyRenamer is fixed and committed to svn.

Changed in pyrenamer:
status: In Progress → Fix Committed
Revision history for this message
Jim Robert (jim-jim-robert) wrote :

Hello I'm having the same issue...

Maybe we could add a little code to check which icon set is being used, and then if that icon set does not provide small icons we could use an alternate icon set?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.