Hi,
It seems you're confuse about what is currently slowing down. Scatter
got matrix calculation done... in python. That's expensive, even if we
use Cython.
500/600 is a lot of widgets, and if you are rotating them separately, 60
times / seconds, yes it can be time consuming, but still, it should works.
What you need to check:
- anything related to the scatter center/pos will be updated when you
set force the center to xi,yi. If you have propertiers/widgets/graphics
instruction that depends on them... then they are updated as soon as you
move the center
- if it's graphics instruction, just imagine that you are updating the
content (and re-upload the content to the GPU) of the graphics
instruction, 600 * 60 times per seconds. Still, i'm sure your GPU is fine.
- ensure they are not in a layout: the layout will listen to the pos of
the childrens. so it will stress the layout for nothing.
- learn about quad tree: even if we don't have a widget at all, i don't
see what's the use case of having 600 scatters rotating. you might a
more intelligent way to order the scatter rather than all in a list
- if each scatter have lot of graphics instruciton, see how much it need
to draw one frame, and act using this information (maybe use an
intermediate Fbo to lower the usage of graphics pipeline, but that's the
ultimate case).
If you want us to have a clearer view about your case, give us a test
case :)
Mathieu
Le 25/07/2013 09:49, Damien Frikha a �crit :
> These optimisations don't change anything, this is just as slow as if
> was before. Even if I don't even add the widgets aren't added to a
> parent widget to be drawn somewhere, it is just as slow, meaning that I
> was wrong to consider this like GPU work.
>
> These widgets each contain a canvas-drawn symbol that together form a
> map. The map needs to be upgraded at each frame because all coordinates
> of those widgets must be calculated from the map center, which represent
> a "moving" object (namely a plane) that remains at the center of the
> screen (like a radar). Moving the entire map doesn't work because the
> coordinates on the map depend on the position of the plane in space. The
> map rotates but the symbols have to keep the same orientation, hence the
> scatter to compensate the global rotation.
>
> Would it be solve my performances issue if i stopped using widgets,
> replacing them by drawing directly on the canvas and clear/redraw
> everything at each frame ? It would be a pain to code properly to keep
> the good position and orientation of each symbol but it seems doable.
>
> Le mercredi 24 juillet 2013 20:29:11 UTC+2, qua-non a �crit :
>
> The link I posted for performance tips, mentions minimizing your dot
> look ups. So first try
>
> | forwidget in scatter_widgets:
> widget.rotation= -thetai
> widget.center = (xi,yi)
>
>
> |
> |Secondly try and consider if your app really need 500-600 widgets
> or could this work better if you just draw directly to the canvas.
> |
> |Without much context with that loop Can't really say, you'd need to
> do the tests yourself.
>
> |
> |Best Regards
> |
> ||
>
>
> On Wed, Jul 24, 2013 at 7:18 PM, Damien Frikha <
damien...@gmail.com
> <javascript:>> wrote:
>
> What's taking so long to perform in my code is when i'm trying
> to move and rotate a lot of Scatter Widgets, like this :
> |
> fori inrange(0,len(scatter_widgets)):
> self.scatter_widgets[i].rotat__ion=-thetai
> self.scatter_widgets[i].cente__r=(xi,yi)
> |
> where len(scatter_widgets) can be up to 500-600, and this code
> is called at each new frame.
>
> But maybe this isn't GPU work, the issue is the same if my
> widgets are empty (they contain a canvas-drawn symbol normally),
> you must be right. In that case i might be asking too much to my
> CPU, but I find it strange that it couldn't manage to execute
> that smoothly, but maybe i'm wrong ?
>
> What could I do then (aside doing something completely different) ?
>
> Le mercredi 24 juillet 2013 14:59:56 UTC+2, qua-non a �crit :
>
> Depends upon your app, and the way you have written it. Did
> you follow
>
http://wiki.python.org/moin/__PythonSpeed/PerformanceTips
> <
http://wiki.python.org/moin/PythonSpeed/PerformanceTips>.
> from it, send an email to kivy-users+...@__
googlegroups.com.
>
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
>
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to
kivy-users+...@googlegroups.com <javascript:>.
> <
https://groups.google.com/groups/opt_out>.