kktuax / youtupi

YouTube (mobile) web frontend for your Raspberry Pi
https://maxtuni.es/2013/02/16/Introducing-YouTuPi.html
20 stars 6 forks source link

Slow local search #10

Open Midako opened 10 years ago

Midako commented 10 years ago

Hey Max, it looks like the search for the local function is really slow, maybe it is some problem of me or do you know why ? im using youtupi on a Raspberry pi Rev B with 512 MB Ram when im using the normal function "find path | grep Name (with pattern)" its much faster or the php script i did write until i did see ur programm... maybe u know a answer for this

Thank You

Midako commented 10 years ago

Starting directory is the same

kktuax commented 10 years ago

Search is performed by looking into every sub-directory so you are right it's probably not the fastest way. Also no caching is performed so the filesystem has to be accessed on every query.

You can probably improve the performance if you limit your search to a the directory where your media is, with a configuration like:

{
    "local-folders": [
        "~/Media", "~/Downloads"
    ],
    "download-folder": "~/Downloads"
}

If you have programming skills maybe you can improve the find_files function from: https://github.com/kktuax/youtupi/blob/master/youtupi/modules/local.py

Midako commented 10 years ago

never did write in python ^-^ i did set the config for local folders on /media/dir/dir at the end of the dir are 2 dirs without sub dirs and then there are one dir with few sub dirs something about 47GB i will look if it works faster if i just use one dir with no sub dirs im using a external hdd for medias its mounted but even if i just use the one folder for search it needs long 450~ GB is in the one folder so maybe python is'nt that fast...but i think not its python self more how he search maybe :S

Tested with: 450~GB - Slow 3,5~GB - Faster but somehow slow instead of my PHP script 45~GB - Faster then 450~ but even slow.... maybe you should use the function glob for python, looks like the same as PHP

Midako commented 10 years ago

did u found already something ?