-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hypermedia feature slow due to OpenStruct #88
Comments
I saw a gem called |
I'll try that gem out. Super busy in my day job, so may not get to it On Wed, Jan 29, 2014 at 4:14 PM, Nick Sutterer notifications@git.luolix.topwrote:
|
FastOpenStruct is not a drop in replacement for OpenStruct. It doesn't On Wed, Jan 29, 2014 at 5:52 PM, David Shepherd dtshepherd@gmail.comwrote:
|
You know what would help? A rails app setup with profiling. I'm thinking about just using a self-made OpenStruct. |
Agreed, I'm not very helpful here am I? :) That was my other thought, just write your own OpenStruct for this purpose. I think hypermedia is the most time consuming in my app right now. ~20% time for the rails url helpers and 80% for the OpenStruct on the fly hypermedia creation. However, this performance hit was only realized after I switched to decorators. The extend method killed performance for large queries (>500 items returned). I went from 100 seconds for a 1000 item query to just under 3 seconds. While to_json for standard rails (no roar) took ~3 seconds as well. Performance tuning sucks... On Thu, Feb 6, 2014 at 11:24 PM, Nick Sutterer notifications@github.com
|
But this should be an easy win - so we need a simple setup with like 500 items, each with hyperlinks? We don't even need a database for that, neither Rails. |
Yep, let me see if I can rig a test like that. Make sure it reproduces the problem. On Thu, Feb 6, 2014 at 11:43 PM, Nick Sutterer notifications@github.com
|
What became of this? Noticing performance problems myself on larger collections |
Nothing, yet, because I can't do 5 million things at the same time. 💃 I doubt that the performance is because of an OpenStruct. Have you tried representable 2.1? It's got about 30-40% speedup by simply removing Ruby's delegator and |
I've been having issues with hypermedia performance when returning a large collection that has hypermedia in each item. Running ruby prof, I found most time is spent in hypermedia link generation, specifically the OpenStruct creations. Doing some research, it looks like this is a know issue:
http://stackoverflow.com/questions/1177594/ruby-struct-vs-openstruct
It can be 100x slower than just using hashes and are memory hogs. Trying to think of a good way to replace this and keep hypermedia...
Short term hack would be to do inline collection, manually define a getter method for each link, and mark each read-only. There has to be a better way though.
The text was updated successfully, but these errors were encountered: