jsonapi-suite / jsonapi_compliable

MIT License
20 stars 35 forks source link

Index children arrays to remove quadratic time complexity #135

Closed AndrewO closed 5 years ago

AndrewO commented 5 years ago

After profiling a call, I saw that more than half of the time was spent in a single has_one sideload. The existing code has a couple of cases of nested loops which were at the root of this. Replacing the inner loops with Hash lookups caused my request time to go from >3.5s to ~1s (at which point, a lot of that is dependent on latency from upstream resources and Rails itself).

richmolj commented 5 years ago

Looks great, thanks! 👍

richmolj commented 5 years ago

Released in 0.11.27