google / liquidfun

2D physics engine for games
http://google.github.io/liquidfun
4.68k stars 641 forks source link

Project based on LiquidFun #57

Open pdrumm opened 8 years ago

pdrumm commented 8 years ago

Hello all,

Similarly to Jim Hye (who posted an issue about a year and a half ago), my team and I found LiquidFun very intriguing and have selected it as the subject of our final project. Rather than parallelizing the code however, we are looking for ways to make LiquidFun run faster or more efficiently relating to data stuctures. Basically we are looking for anywhere in the program that might slow up a little bit - where we might be able to implement an alternative, more efficient sorting algorithm, searching algorithm, or data structure to store things.

We would appreciate any advice as to where in the program these optimizations might be most useful!

Thanks, Patrick Drumm

stewartmiles commented 8 years ago

A good starting point for this would be to profile an application (e.g the Testbed) to determine which areas are most expensive given a particular simulation. This would enable you to determine where to focus optimization efforts.

If you're running on Linux boxes consider using https://perf.wiki.kernel.org/index.php/Main_Page If you're using OS X you could profile using XCode Instruments On Windows there is a huge selection VTune, AMD CodeX, Visual Studio Profiling Tools etc.

Jason (see the git log) - after profiling - spent a lot of time rewriting the particle simulation in ARM SIMD which yielded significant gains. An x86_64 version using intrinsics may be reasonable and maintainable. You could also try plumbing MathFu https://github.com/google/mathfu in to get SIMD optimization across the library to see whether that yields a gain.

Cheers, Stewart

On Tue, Oct 6, 2015 at 12:17 PM, Patrick Drumm notifications@github.com wrote:

Hello all,

Similarly to Jim Hye (who posted an issue about a year and a half ago), my team and I found LiquidFun very intriguing and have selected it as the subject of our final project. Rather than parallelizing the code however, we are looking for ways to make LiquidFun run faster or more efficiently relating to data stuctures. Basically we are looking for anywhere in the program that might slow up a little bit - where we might be able to implement an alternative, more efficient sorting algorithm, searching algorithm, or data structure to store things.

We would appreciate any advice as to where in the program these optimizations might be most useful!

Thanks, Patrick Drumm

— Reply to this email directly or view it on GitHub https://github.com/google/liquidfun/issues/57.

Razzlegames commented 8 years ago

Valgrind is also a pretty good tool for this (Unix-ish systems): http://c.learncodethehardway.org/book/ex41.html . Keep in mind though, the base of Liquid fun is Box2D. So any performance tuning in the base code could be contributed back to that project. Maybe you're just talking about the "Liquid" features though.

On Tue, Oct 6, 2015 at 1:13 PM, Stewart Miles notifications@github.com wrote:

A good starting point for this would be to profile an application (e.g the Testbed) to determine which areas are most expensive given a particular simulation. This would enable you to determine where to focus optimization efforts.

If you're running on Linux boxes consider using https://perf.wiki.kernel.org/index.php/Main_Page If you're using OS X you could profile using XCode Instruments On Windows there is a huge selection VTune, AMD CodeX, Visual Studio Profiling Tools etc.

Jason (see the git log) - after profiling - spent a lot of time rewriting the particle simulation in ARM SIMD which yielded significant gains. An x86_64 version using intrinsics may be reasonable and maintainable. You could also try plumbing MathFu https://github.com/google/mathfu in to get SIMD optimization across the library to see whether that yields a gain.

Cheers, Stewart

On Tue, Oct 6, 2015 at 12:17 PM, Patrick Drumm notifications@github.com wrote:

Hello all,

Similarly to Jim Hye (who posted an issue about a year and a half ago), my team and I found LiquidFun very intriguing and have selected it as the subject of our final project. Rather than parallelizing the code however, we are looking for ways to make LiquidFun run faster or more efficiently relating to data stuctures. Basically we are looking for anywhere in the program that might slow up a little bit - where we might be able to implement an alternative, more efficient sorting algorithm, searching algorithm, or data structure to store things.

We would appreciate any advice as to where in the program these optimizations might be most useful!

Thanks, Patrick Drumm

— Reply to this email directly or view it on GitHub https://github.com/google/liquidfun/issues/57.

— Reply to this email directly or view it on GitHub https://github.com/google/liquidfun/issues/57#issuecomment-145984690.

migdalskiy commented 8 years ago

Obviously, profile what you are about to optimize, but if you're after learning how to optimize, might I (not so) humbly suggest my GDC talk about optimization strategies? https://www.youtube.com/watch?v=Nsf2_Au6KxU