will / crystal-pg

a postgres driver for crystal
BSD 3-Clause "New" or "Revised" License
462 stars 77 forks source link

Stop shelling out to whoami #257

Closed will closed 1 year ago

will commented 1 year ago

For finding a default username and database name when none is given (eg postgres:///), this would previously shell out to running the whoami command. Now it calls libc directly to find the current username.

This was especially slow for the tests before cafe09ed5547 but even now finding this change brings the tests from (avg over 10 runs counting compile time) 7.87 seconds down to 6.94.