Skip to content

Lazily evaluate relationship objects only when included#31

Merged
fotinakis merged 3 commits intofotinakis:masterfrom
mwpastore:lazy-relationships
Dec 7, 2015
Merged

Lazily evaluate relationship objects only when included#31
fotinakis merged 3 commits intofotinakis:masterfrom
mwpastore:lazy-relationships

Conversation

@mwpastore
Copy link
Copy Markdown
Contributor

My clumsy attempt at a fix for #29

@mwpastore
Copy link
Copy Markdown
Contributor Author

Passing an enumerable Sequel dataset to JSONAPI::Serializers: 1400ms, 1084 queries
^^ converting the dataset to a resultset with .all before serializing: 750ms, 580 queries
^^ with this fix: 460ms, 300 queries
^^ with Sequel eager loading: 130ms, 3 queries

Not bad for a day's work!

@mwpastore
Copy link
Copy Markdown
Contributor Author

@fotinakis Any thoughts on this? There are a few different ways to implement the changes and I'm happy to make as many attempts as it takes to make you happy. 😄 Let me know. Thank you.

@fotinakis
Copy link
Copy Markdown
Owner

Hey @mwpastore, this looks pretty nice. I'm going to test this against an application I have now and let you know.

@fotinakis
Copy link
Copy Markdown
Owner

LGTM 👍 Thanks for doing this, things look like they are backwards-compatible. I will release a new gem after merging.

fotinakis added a commit that referenced this pull request Dec 7, 2015
Lazily evaluate relationship objects only when included
@fotinakis fotinakis merged commit 6fa2877 into fotinakis:master Dec 7, 2015
@fotinakis
Copy link
Copy Markdown
Owner

I've pushed v0.3.1 which includes this change.

@mwpastore
Copy link
Copy Markdown
Contributor Author

👍 Thanks Mike!

@mwpastore mwpastore deleted the lazy-relationships branch February 27, 2016 21:22
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

Successfully merging this pull request may close these issues.

2 participants