feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 742 forks source link

Resolver Performance #3492

Open DaddyWarbucks opened 1 month ago

DaddyWarbucks commented 1 month ago

I was clicking around the repo today and noticed this issue: https://github.com/feathersjs/feathers/pull/3487. It reminded me that awhile back I completed an issue for yup.js that I believe resolvers could also benefit from.

See: https://github.com/jquense/yup/issues/2052

The problem is that the resolvers treat ALL resolver functions as async and pushes/pops them onto the event loop. This means it schedules potentially sync work on the event loop. This can be solved by creating a more callback oriented flow that allows sync functions and async functions to be scheduled differently.

I don't think the performance benefits will be as great here as they were in yup.js. Yup generally has more "resolvers" and are more regularly sync. Feathers resolvers generally have fewer "resolvers" and are more commonly async. But, for large datasets I bet there would be a considerable performance gain.