Posted January 30, 2015 in general is there a way I can do the same job of 3 nested for loop but faster Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 elaborate. Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 Recursion? My Server - Update 1 - Update 2 - Update 3 - Update 4 Gaming Rig Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 Recursion? That's probably slower. Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 That's probably slower. Easier to understand though. 3 nested loops just sounds like a mindfuck lol My Server - Update 1 - Update 2 - Update 3 - Update 4 Gaming Rig Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 Easier to understand though. 3 nested loops just sounds like a mindfuck lol 3 nested loops are not so bad tbh. Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 You might be able to unroll a loop or just figure out a better way to code it. Those are really your only options Recursion? When you call, you push ESP and EBP to the stack, along with any parameters... and if you have 3 levels of recursion, that's gonna be a nightmare. Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 Even if the loops are necessary there are efficient and inefficient ways of implementing them. Do it wrong and you'll get cache thrashing, which will reduce performance by orders of magnitude. Audio Reference • Cutting the Crap • 7.1 Headphones? • Audio Interference Troubleshooting GuideREVIEWS • HiFiMan HE-560 • Beyerdynamic T1 2. Generation • Schiit Bifrost 4490 • Schiit Valhalla 2RECOMMENDATIONS • The Audio Board's Recommended Gear Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 30, 2015 Even if the loops are necessary there are efficient and inefficient ways of implementing them. Do it wrong and you'll get cache thrashing, which will reduce performance by orders of magnitude. Any recommendations on not having loops do cache thrashing, other than the obvious like using fewer/smaller variables? Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted January 31, 2015 Any recommendations on not having loops do cache thrashing, other than the obvious like using fewer/smaller variables? Well, a basic one is making sure to read multidimensional loops in the right order. When you access memory, a line of memory will be read and stored in the CPU cache. This works great if you are reading across rows in the array. But if you are reading down columns, the CPU will be forced to go to memory for each operation instead of being able to rely on the much faster cache until getting to the next row. Google for loop tiling and strip mining. Compilers will try to do optimizations like this on their own, but the more you help them the better the performance potential. Audio Reference • Cutting the Crap • 7.1 Headphones? • Audio Interference Troubleshooting GuideREVIEWS • HiFiMan HE-560 • Beyerdynamic T1 2. Generation • Schiit Bifrost 4490 • Schiit Valhalla 2RECOMMENDATIONS • The Audio Board's Recommended Gear Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now