Farama-Foundation / Arcade-Learning-Environment

The Arcade Learning Environment (ALE) -- a platform for AI research.
https://ale.farama.org/
GNU General Public License v2.0
2.14k stars 420 forks source link

Software Optimization for ALE #224

Closed pedronahum closed 6 years ago

pedronahum commented 6 years ago

Hi,

I have been benchmarking the performance in Windows (https://github.com/pedronahum/Arcade-Learning-Environment), and noticed significant improvements just by flattening some multi-dimensional arrays (eg, m_rgb_ntsc, m_avg_palette, etc).

Would you be interested in a pull request to optimize the performance of ALE for the GCC and ICC compiler?

Regards,

mgbellemare commented 6 years ago

Hi,

Good to hear from you, that sounds very interesting. Your fork suggests 30-35% improvements -- quite impressive. Is that mostly from flattening the arrays?

This is something we'd certainly be interested in having a look into. Could you push individual optimizations so I can have a look at them carefully?

pedronahum commented 6 years ago

Hi,

To be honest, I didnt much do much :o)

Flattening the arrays gave me the biggest performance bump (25-30%). Then the second contributor was data alignment. Data alignment, however, may be more complicated to generalize across compilers.

Happy to send you individual optimizations, but maybe it is an overkill as just flattening m_rgb_ntsc, m_avg_palette and myPriorityEncoder will give you a very good performance bump.

Happy to help, just let me know.

mgbellemare commented 6 years ago

Let's start with the array flattening then. Thanks!

pedronahum commented 6 years ago

Very good. In the next few days I will create an array flattening branch and send to you for your review. Thanks