OpenStruct defines methods at runtime and by that invalidates the global method cache which can impose quite a significant performance penalty as demonstrated here and there. this is critical using it in larger rails applications, for example.
there have been patches proposed (9262, 8426, 7816) to mri but as far as i can see no real progress was made.
also, this reddit thread is quite insightful with comments as recent as 1 year ago.
this pr removes
OpenStruct
from runtime logic.OpenStruct
defines methods at runtime and by that invalidates the global method cache which can impose quite a significant performance penalty as demonstrated here and there. this is critical using it in larger rails applications, for example.there have been patches proposed (9262, 8426, 7816) to mri but as far as i can see no real progress was made.
also, this reddit thread is quite insightful with comments as recent as 1 year ago.