gosnowflake
gosnowflake copied to clipboard
Cache tz -> *time.Location results
Description
snowflakeRows.Next calls getCurrentLocation for every row, which means that the driver calls time.LoadLocation (which loads the TZ database) for every single row in the results of a query. Instead, we should only fetch it once, which we can do on the Config object.
In a simple application that runs queries and fetches a large number of rows, getCurrentLocation accounts for 65% of our overall CPU usage:

Checklist
- [x] Code compiles correctly
- [x] Run
make fmt
to fix inconsistent formats - [x] Run
make lint
to get lint errors and fix all of them - [ ] Created tests which fail without the change (if possible)
- [ ] All tests passing
- [ ] Extended the README / documentation, if necessary
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA