I actually already had profiling enabled and ironically, that was causing
the super choppy FPS slideshow when moving windows. However, even with when
I turn off profiling we are talking drops from 1200 -> 100 when moving
about 30 widgets (half of which are Pyglet Labels).
Maybe I should be trying to analyze the profile? Although I'm not sure how
much improvements I can realistically make.
Currently have it setup Widget Creation (Rect/Properties) -> Drag -> Update
Widget Position + Visible Children -> Update Render Position
+ Visible Children
Anyways, thanks for the help guys. I think at this point I'm crossing into
other issues, although updating Pyglet labels are causing more slowdowns
than textures of text. (Which is more reasonable at 1200 -> 300) Still a
large drop.
I profiled just opening up the game, moving a window for about 20 seconds
and these are the top internal time. Seems like most of it is updating
positions that give me the most time. I really don't know how to improve a
process that is essentially a loop of setting values for rectangles and
sprites, it's just there are many to set. I'll have to think on other ways
to do this, any suggestions are welcome.
Thu Feb 04 22:29:22 2016 profiletest
16591980 function calls (16576791 primitive calls) in 20.112 CPU
seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
5255 1.020 0.000 1.020 0.000 c:\python26\lib\site-packages\
pyglet\gl\win32.py:223(flip)
1 0.987 0.987 4.855 4.855 D:\PygletGame\client\implem\
game.py:31(__init__)
88740 0.520 0.000 1.586 0.000 D:\PygletGame\client\render\
gui\core.py:378(_updateBackgroundPosition)
287514 0.509 0.000 1.039 0.000 D:\PygletGame\client\render\
sprite.py:420(setPosition)
126169 0.453 0.000 0.969 0.000 {map}
543016/542983 0.452 0.000 0.452 0.000 {getattr}
121859 0.442 0.000 0.569 0.000 D:\PygletGame\shared\container
\geometry.py:235(_setX)
147961 0.392 0.000 1.091 0.000 c:\python26\lib\site-packages\
pyglet\text\layout.py:1405(_set_x)
121858 0.392 0.000 0.503 0.000 D:\PygletGame\shared\container
\geometry.py:241(_setY)
84786 0.384 0.000 2.689 0.000 D:\PygletGame\client\render\
gui\core.py:822(_updateTextPosition)
288035 0.359 0.000 0.359 0.000 {rabbyt._rabbyt.
render_unsorted}
147909 0.353 0.000 1.010 0.000 c:\python26\lib\site-packages\
pyglet\text\layout.py:1430(_set_y)
318705 0.303 0.000 0.472 0.000 D:\PygletGame\shared\container
\geometry.py:253(getTopLeft)
27495 0.288 0.000 0.911 0.000 c:\python26\lib\site-packages\
pyglet\graphics\vertexdomain.py:279(draw)
42040 0.279 0.000 0.566 0.000 D:\PygletGame\client\render\
render.py:33(setViewport)
1111680 0.262 0.000 0.262 0.000 c:\python26\lib\site-packages\
pyglet\text\layout.py:1411(<lambda>)
1110588 0.254 0.000 0.254 0.000 c:\python26\lib\site-packages\
pyglet\text\layout.py:1436(<lambda>)
165955 0.234 0.000 0.481 0.000 D:\PygletGame\client\render\
gui\core.py:732(render)
114889 0.225 0.000 1.835 0.000 D:\PygletGame\client\control\
gui\widget.py:319(updateOnlyRealPosition)
158079 0.223 0.000 0.223 0.000 c:\python26\lib\site-packages\
pyglet\gl\lib_wgl.py:80(__call__)
250263 0.213 0.000 0.296 0.000 c:\python26\lib\site-packages\
pyglet\graphics\vertexbuffer.py:466(invalidate)
287514 0.186 0.000 0.530 0.000 D:\PygletGame\client\render\
sprite.py:408(setRenderPosition)
Maybe I'm just doing this wrong.
On Wednesday, February 3, 2016 at 8:32:00 AM UTC-6, elliot wrote:
>
> That doesn't sound right. I'd suggest changing your main loop to update
> the position of that frame every draw cycle and the profile it like `python
> -m cProfile -s cumtime your_script.py`
>
>
> Elliot
>
> On Tue, Feb 2, 2016 at 11:56 PM, Charlie <[email protected] <javascript:>>
> wrote:
>
>> Ah I see. In my GUI, the windows are movable and can be overlapped on one
>> another; as such each widget is rendered one by one based on the order they
>> were added to the container. So this makes trying to fit pyglet text and
>> batching in there difficult.
>>
>> What I ended up doing was just creating a separate batch for each of my
>> "containers" that hold widgets. This way each container can overlap without
>> issue.
>>
>> I have however noticed performance issues on moving labels. Since my
>> Window containers are movable, I want to drag them around sometimes. When
>> trying to update the position of the Labels of a particular container, the
>> FPS just dies and goes to 0. Even if there is just a handful. Is there
>> anyway to update the batch to move all objects by X, Y to improve
>> performance? Or any suggestion/hacks? :) Thanks.
>>
>> On Saturday, January 30, 2016 at 9:44:17 AM UTC-6, Serdar Yegulalp wrote:
>>>
>>> Most of what I've been doing involves HUD display type things where the
>>> order is fixed to begin with, so I haven't yet run into a scenario where I
>>> have to re-order the batch. One thing you can do is set up two batches, one
>>> for background and one for foreground elements, add to the appropriate
>>> batches as needed, and then draw those batches back to front (background,
>>> then foreground).
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyglet-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/pyglet-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.