mailchuck / PyBitmessage

This repository has been discontinued, please use the official PyBitmessage repository

Home Page:https://github.com/Bitmessage/PyBitmessage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avatars slow on USB

PeterSurda opened this issue · comments

When using USB and Portable mode and avatars are on, scrolling messagelist is a bit slow, and so is creating the inbox popup menu. Testing revealed that when avatars are off, this problem doesn't exist. So maybe the avatar functions do something with the disk that slows them down.

I tried portable mode on the same machine but on SSD rather than USB, and this problem doesn't appear.

For some reason, the "stat" system call on Windows, which is used in "os.path.isfile" python function, is at least 20 times slower (sometimes more like 60 times) on a USB stick than on a non-removable disk. Turning on indexing and reformatting to NTFS does not help. This is triggered when looking for images in the "avatars" directory. The "stat" performance is not affected by whether the file you're looking for is present or not. The "avatarize" function executes os.path.isfile 56 times per address, and the repaint of an entry leaves the avatar data to the custom "data" function of the classes in foldertree.py and they call "avatarize" every time a repaint is requested. This all cumulates to thousands of calls to "stat" whenever something is happening in the UI, and causes freezes.

A possible fix is to remove the ability to have custom avatars (in the "avatars" subdirectory), or store them elsewhere, or add caching on top of the directory. All of them have drawbacks so I'm postponing.

Tested on linux and it seems fine.