-
-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eel.init takes 20seconds #393
Comments
Otherwise you can debug it with the normal tools, eg pdb/ipdb, by setting a trace in the Eel library code for the init function to see exactly what's going on. |
@samuelhwilliams Hello Samuel, The python I am using is not available for Raspbian Stretch and I had to compile it from the source. I think this could have played a major part in it. I will try multiple versions of Python3 and see if there's any improvement, before I try the pdb/ipdb. |
A very quick (and dirty) check might be to insert a P.S. Eel is only officially supported on 3.6, but depending on your use-case and how much maintenance it needs, you might be able to get away with using it on 3.5 - so possibly worth giving that a shot as well? Obviously not if that's a production use-case though. |
The reason for the whitelist of file extensions was to speed up this bit. Previously I was making a map app which had a folder with hundreds of OpenStreetMap tile images, and it was taking a long time to start up. I also suggest Sam's debugging idea; you can also print |
@samuelhwilliams I decided not to use the 6s javascript file, and for the 12s javascript file I used the minified version. Now, that I know the minified versions of javascript file have great impact on the initialization, I will try to minify every javascript file. |
Still too long IMO. Maybe we should be hashing the file, and caching parse results, so that it's faster if the file hasn't changed. |
Out of curiosity @shrsulav, how big are your JS files? |
The size itself does not seem big. The unminified version is around 600kB and minified version is 220kB. The number of lines of code is high though. Around 20k lines of code. |
@samuelhwilliams Earlier you had mentioned, there's a way to use eel with python 3.5. Can you provide the details on how to do that? |
I think should add a allow prefix argument in eel.init() if need. |
Hello, It's definitely an issue (solution below, so chill down....). I don't know the reason, but suddenly init took ages (order of minutes). I build static assets in Vue (works like a charm in debugging on server (hope i add examples one day)). I changed webpack optimize options and separated it into small items, then run debug and analyzed where is the problem. It's not only about big files - if js file has around 100kb, it took about 3 seconds (don't know why...) and it seem that time is not linear with size Problem is definitely not in parsing file structure in init folder - that's miliseconds. This line is problematic...
The parseString from pyparsing - analysis of js code (probably finding exposed functions) (but i doubt that it's caused by version change). Maybe it's not an issue, it just takes a time (it's not easy to regex find big files) - but still there have to be a workaround. Use case
WorkaroundI build assets in vue
Webpack separate my functions and 3rd party libraries (then webpack add I suppose there is not exposed function in To
around line 113
This will skip js parsing for this file... There is already similar name check, so seems ok... Now only user code is parsed - and it's fast again... I would do merge request, but i don't know if maybe some more general solution will raise... |
Hi, I suggest better pass the allow prefixs.
Pass the prefixs filter when init eel
|
Hi... yes, that's the reason why didn't merge request i just made workaround. It's question what's good general solution and it depends on use case. In one project i have most of own js and i prefer exclude logic, in other project i use most of generated 3rd party libraries and i need only few file, i would appreciate to define list of parsed files there. It's an open question how to solve it. From my point of view add exclude prefix pattern is most simple to implement and not affection other users. eel.init('pages-folder', excluded_prefixes=['start-with-me']) When i have time, i'll do merge request... |
I'm not able to create new branch to create pull request. Do you have permissions @t-walker-wei ? And what about @samuelhwilliams or @ChrisKnott opinion on this. I think exclude logic is much simplier and has no impact on users that don't want to use it... Adding if excluded_prefixes and any(name.startswith(excl) for excl in excluded_prefixes):
continue Makes init from one minute to one second in my case - of course this is only issue with framworks like vue, but definitely worth for many users... |
Until it's solved - i created a fork and pushed to Pypi as EelForkExcludeFiles. When it's solved, i'll remove the fork... |
How about letting us choose which files are to be scanned? |
Both ways seems legit. Define what files should be used or define what files should be ignored... It's really minor change of code and it has huge impact on startup time if using framework like Vue or react and some bigger npm libraries. For me it was from about 10 seconds to 1 second... Personally i prefer regex ignore pattern as for me all npm libraries has always the same prefix, so for all my projects init syntax is the same... Imho this should be reopen... |
I've just come across this issue - in my web folder I have the font-awesome assets. Took me a while to figure out that was causing the long start up times. Will try your fork @Malachov |
@Malachov works perfectly - thanks! This should definitely be re-opened and accepted |
That would be sweet... I really like this library Once I have time, I'll create pull request with simple workaround, which may not be generic, but on the other hand it's fully backward compatible I saw, that some pull requests are accepted, so repo is still alive... |
A bit slow... but still alive. I'll take a look if you submit an updated PR (your previous one is out of date). |
Merge is there. It's backward compatible. Tests added. I don't know whether should I add Type hints. I saw a merge with |
Describe the problem
In Raspbian Stretch, Python 3.5 is the highest supported version. But for eel Python 3.6 is required. So, I looking at tutorials I compiled Python 3.6 for Raspbian Stretch and got eel working but the line "eel.init" is taking 20 seconds.
How can I debug this issue?
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: