You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if metadata
columns = res.result_metadata.fetch_fields.collect do |col|
...
I was profiling my code to find bottlenecks and discovered that result_metadata was costing me a lot of CPU time
Line should be: columns = metadata.fetch_fields
Also, seems like metadata/columns/schema should only be calculated once unless there's a good reason why it shouldn't be.
The text was updated successfully, but these errors were encountered:
I have re-factored this function such that schema has been converted to an instance variable that is lazily initialized upon the first execution of the prepared statement. The end result is that my engine now runs over 6 times faster and maintains consistent throughput which is a big deal.
mysql.rb:411-414
...
metadata = res.result_metadata rescue nil
if metadata
columns = res.result_metadata.fetch_fields.collect do |col|
...
I was profiling my code to find bottlenecks and discovered that result_metadata was costing me a lot of CPU time
Line should be: columns = metadata.fetch_fields
Also, seems like metadata/columns/schema should only be calculated once unless there's a good reason why it shouldn't be.
The text was updated successfully, but these errors were encountered: