Thanks for the gem. I've found one potential performance improvement:
In some cases we are able to manage the number of records through parameters of the request, for example, when we have pagination:
get :index, params: { per_page: 10 }
or in GraphQL:
query {
posts(limit: 10) { id }
}
In those cases we don't need to recreate records before each run of actual block and can manage it as in the example.
For this purpose I've added scale method, which is an alias to current scale factor of executor. Supposed usage:
context "N+1", :n_plus_one do
specify do
expect { get :index, params: { per_page: scale } }.to perform_constant_number_of_queries
end
end
Hey Vladimir!
Thanks for the gem. I've found one potential performance improvement:
In some cases we are able to manage the number of records through parameters of the request, for example, when we have pagination:
or in GraphQL:
In those cases we don't need to recreate records before each run of
actual
block and can manage it as in the example. For this purpose I've addedscale
method, which is an alias to current scale factor of executor. Supposed usage: