Please review and challenge the solution. I think it can be improved even more, but even with the current implementation, you can get 5-15% speed improvements with just a few lines of code.
I can see a speedup from memoizing, and maybe from a database or other IO call, but I don’t imagine that rendering Views concurrently in Threads would be any faster, and would likely be slower, than doing them serially. That’s because View Rendering is CPU bound, and the Ruby GVL would mean that only 1 thread at a time would ever be running.
Yes, it will be faster, but maybe not in every situation. I know that on my pet project, I have the actual result, I can see the numbers. There is no need to use it to render the simple shared/google_analytics partial. I think I mentioned it in the gem, that gem is not for all cases.
Interestingly, you are saying it will not work, even without trying . Maybe, with an example of rendering 100K
it won’t, but on real-world application I think it will.