Thanks. That sounds like good advice. I'll try it and get back to you. It bears out so far though - trying it in Maya 2017 I see a huge amount of swapping going on.
To answer your question Marcus, I guess I was doing it this way because it used to work! The documentation for QIcon says "The file will be loaded on demand," and although it's not entirely clear what that means, in PySide2 it's definitely loading it before the icon has even been added to a visible widget. On Tuesday, 23 May 2017 05:41:01 UTC+10, Justin Israel wrote: > > > > On Tue, May 23, 2017, 3:42 AM Marcus Ottosson <konstr...@gmail.com > <javascript:>> wrote: > >> Loading 50k jpegs at 512x512 at ~1 second? >> >> It sounds like Qt 4 was deferring the actual load of these files until >> you viewed them, whereas Qt 5 is loading them into memory. Not impossible, >> could be an optimisation on their part. >> >> But why on earth would you do this? :O Sounds incredibly inefficient. Why >> not have icons instantiated when you view them, through the .data() >> member of your model, and optionally cache them yourself where necessary? >> >> 512 x 512 x 8 bits x 4 color channels x 50,000 images comes to 419 gb of >> memory utilisation, unless some of your images are the same. >> >> What’s wrong with this picture? >> > That would be gigaBITS ;-) . Also jpegs are 3 channel usually. So it would > be more like: > 512x512x(8x3)/8 = ~39GB of uncompressed image data. But it would > probably end up mostly going into swap memory. If you don't run out of > virtual memory and you aren't swapping too hard then your program could > function. It would then depend on how much of that data Qt wants to load > active at once. > > That suggestion you made of implementing data() on the model, loading on > demand, and caching a realistic max number at a time, seems like it would > work great to solve this problem. > > > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to python_inside_maya+unsubscr...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODrO8hMjrAvYQPP1BT7eXRm6RVXCVtZZrUDm4DYn0cXBQ%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODrO8hMjrAvYQPP1BT7eXRm6RVXCVtZZrUDm4DYn0cXBQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/eb4e85bd-fe2c-41b7-b6da-96939f156156%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.