Skip to content
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

Every call to to_param results in an extra network call. #826

Closed
iHiD opened this issue Jun 8, 2015 · 2 comments
Closed

Every call to to_param results in an extra network call. #826

iHiD opened this issue Jun 8, 2015 · 2 comments

Comments

@iHiD
Copy link
Contributor

iHiD commented Jun 8, 2015

Hello. Thanks for all your fantastic work in making this!

tl;dr; An index page of results is resulting in 150 extra network calls.

I'm only just starting to play with this so I may be missing something.

  • On an index page, I have a list of 50 items.
  • Each has the standard view/edit/delete links.
  • I noticed that the page loading was very slow (1s).
  • Commenting out the links sped up dramatically (100ms)
  • I tried stubbing a to_param in the model and it sped back up again.
  • I stepped through the executing code and discovered that it's making a network call per lookup in the to_key method calling out to exist? in the cypher_node.rb.

I'm guessing this codepath is there to check the record has at some point been persisted and so has a key, and that the check to see if it still exists is inadvertent.

Would you except a PR to match ActiveRecord's behaviour here and not check whether it's still persisted, or is this behaviour intentional?

Thanks again! 💙

@subvertallchris
Copy link
Contributor

Really great catch! I've been trying to weed these out but clearly missed this one. If you change that persisted? to _persisted_obj, you'll fix it. Totally down to take a PR if you'd like to do it, otherwise I can get it in there at some point today.

@iHiD
Copy link
Contributor Author

iHiD commented Jun 8, 2015

I'll knock it together now. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants