danini-the-panini / mittsu

3D Graphics Library for Ruby.
https://github.com/danini-the-panini/mittsu
MIT License
510 stars 33 forks source link

Animation is choppy #62

Open nurettin opened 6 years ago

nurettin commented 6 years ago

Hi, I know this is really obvious, but the animation is choppy even on a machine with very modern specs and a good GPU. I get a little pause every second or so. Is this possible to fix?

I am aware that ruby has a stop-the-world garbage collector, so I tried disabling it with GC.disable before any other code is run, but the result is the same.

danini-the-panini commented 6 years ago

Hi @nurettin. Mittsu is still very un-optimized at this point, and I have yet to do any extensive profiling as of yet. This is something I've been meaning to do once I have some time.

You (and anyone else who wants to) are more than welcome to have a go at finding any low hanging fruit in terms of performance improvements. I'm willing to bet there are plenty 😄

nurettin commented 6 years ago

Hi @jellymann I used ruby-profiler to look through the callgraph, but I haven't found anything that sticks out. Not sure how to interpret the call graph. When I look at the render method, It appears that most of the time is spent calling external functions, which should be ideal. However, 1/3rd of that time is spent calling perform_auto_clear, so that might be the culprit. Does this appear correct so far?

image

profile.callgrind.out.3852.zip