Commit 2d3c993
committed
[miq_provision_virt_workflow.rb] Avoid respond_to?
respond_to? calls in mass are slow since they require some object
introspection, where doing a simple `nil` check is much quicker.
By including just the `cloud_tenant_id` in the SELECT clause, it allows
for the swapping of `respond_to?` with an `nil` check, with the
functionality that existed preserved.
Benchmark
---------
**Before**
| ms | queries | query (ms) | rows |
| ---: | ---: | ---: | ---: |
| 28440 | 33 | 1929.5 | 243133 |
| 28491 | 33 | 1933.6 | 243133 |
| 28858 | 33 | 2631.9 | 243133 |
**After**
| ms | queries | query (ms) | rows |
| ---: | ---: | ---: | ---: |
| 27107 | 33 | 1958.5 | 243133 |
| 26803 | 33 | 1944.2 | 243133 |
| 27642 | 33 | 1965.5 | 243133 |1 parent 9e4f558 commit 2d3c993
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
1053 | 1053 | | |
1054 | 1054 | | |
1055 | 1055 | | |
1056 | | - | |
| 1056 | + | |
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
| |||
0 commit comments