#So I did some more testing I wrote a
1 messages ยท Page 1 of 1 (latest)
interesting -- i would expect some hit on these microprocessors for that kind of loading, but had not ever seen any actual data
i also have not seen any guarantee of "instant on" either ๐
Haha, no, of course not. And, as I'm doing more testing, it turns out that my time tracking of import times slow down the startup massively!
The relative differences between file imports and a giant mega-class still remains, but the startup time is at around 1.3 seconds to showing a splash screen, and that is totally fine.
I really could let this go... But... I like messing about with stuff like this to understand it.
yep -- i got a few rabbit holes going myself
I'm now looking at ways to delay imports until they are actually needed. gui.py has code for showing a minimal splash screen, and then a lot more imports for showing fancy stuff involving bitmap fonts and stuff. So, I'm now playing with moving those imports into the functions that actually need them. Saved myself 300 ms! ๐
๐ฅณ
if you have a specific methods that is the only one that needs a specific import, you can inline the import, but you would take that hit there (and possibly every time)
i don't know how that particular mechanism works -- i'm much more a kotlin/java guy, i only python when i have to ๐
It looks like the subsequent times it hits that import statement, it takes like 4ms. So, only the first time you do a particular import actually does the import.
If you're open to sharing your "compile" code that combines them and an example of how you set up the measurements I'd be interested in playing with those capabilities
Sure. Where would I share that? And, my script is a nodejs script so you'd need that installed on your command line. (or rewrite it in your favorite scripting language)
I do think that's true about imports only working the 1st time as well. I don't know the mechanism specifically. But if you have code in the root of the file it only executes the first time you import which makes it slightly harder to iterate over a file and test it in REPL.
Gist, github. Or even just a pastebin, or whatever is easiest for you tbh.
I think it might be interesting to see the timing effects on different projects.
OK. I'll look at in within the hour. Just need to do some domestic chores (including having my first coffee of the day)
absolutely, whenever you get to it is totally cool with me. Thank you for going down the rabbit hole a bit and sharing the numbers as well!
I would love to hear what you two find. I also have a project with quite a few imports. Anything leared would be awesome