mhallin / graphql_ppx

GraphQL PPX rewriter for Bucklescript/ReasonML
BSD 3-Clause "New" or "Revised" License
320 stars 42 forks source link

Increase performance of nested queries #85

Open johnhaley81 opened 5 years ago

johnhaley81 commented 5 years ago

With nested queries the code was switching on the option so that it could display a custom message. This was causing a massive increase in compilation time as the queries got deeper and wider. In my project we were seeing build times of about 6 minutes, after this change the build went down to about 10-11 seconds.

Instead of displaying a custom message, the PPX will now just call out to Js.Option.getExn.

This might also fix #61

wokalski commented 5 years ago

I think we should first understand the cause of the issue (ie how do the differences in output impact compilation performance). Or maybe it’s not differences in the output but the time it takes to compile the make error function

johnhaley81 commented 5 years ago

@wokalski My original idea was that the time it takes the PPX to run was the culprit as well. To test this you can go to this repo here and see that the final generated output of the code is the thing that takes a very long time to build using bsc.

You can see how the above PR changes the final compiled code by comparing the master branch of that graphql-ppx-perf-repo to this

johnhaley81 commented 5 years ago

@wokalski @baransu I'm not quite sure what's going on with the CI stuff. It seems like CI is just currently broken.

Outside of that, are there any other questions I can answer?