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

Sorting always happens on primary key in resource #18

Closed
cwdt opened this issue Mar 25, 2016 · 4 comments
Closed

Sorting always happens on primary key in resource #18

cwdt opened this issue Mar 25, 2016 · 4 comments

Comments

@cwdt
Copy link

cwdt commented Mar 25, 2016

In the WoohooLabs\Yin\JsonApi\Schema\Data\CollectionData class a ksort is performed on the $ids.
I want to order the results the way I setup my SQL (using an 'order by') but this ksort is causing unexpected behaviour. Am I missing something?

@kocsismate
Copy link
Member

Thanks for the report! I have to say that your concerns are totally valid, this behaviour definitely needs to be fixed.

That's why in my last commit (c0ede5a) I significantly reworked how primary and included resources are stored and retrieved. Additionally, as at least 2 ksort() invocations are avoided when returning a collection of resources, this implementation should be faster then the old one. I'll try to discover how much performance gain Yin got.

Furthermore, please review if my commit solved your problem.

@kocsismate
Copy link
Member

I played a little bit with Blackfire: after profiling my PHP 7 app running on Amazon ECS, the benchmarks showed ~1% improvement in wall time and ~3% in CPU time for listing 100 users with complex data. This is not bad, but let's hope for the measurement being correct. :P

@cwdt cwdt changed the title Sorting always happens on primary key in resource, why? Sorting always happens on primary key in resource Mar 29, 2016
@cwdt
Copy link
Author

cwdt commented Mar 29, 2016

Thanks for your quick fix, tested and works 👍! I see positive thing happening in performance too, great!

@kocsismate
Copy link
Member

v0.10.4 has just been released!

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