panates / postgrejs

Professional PostgreSQL client for NodeJS
https://postgrejs.panates.com
MIT License
50 stars 12 forks source link

Avoid os.cpus() calls #26

Closed unilynx closed 1 year ago

unilynx commented 1 year ago

We noticed in profiling that power-tasks will invoke os.cpus() on every created task, even though the taskqueue is fixed at concurrency 1 anyway. It accounts for 3 to 5% CPU usage on some of my benchmarks, so this seems like an easy win

(TBH: this should probably be fixed upstream but we didn't look into that)

erayhanoglu commented 1 year ago

Thank you for reporting this problem. Your commit fixes the problem, but only for this package. I have fixed the problem in the power-tasks package to make this fix common. So i will not pull this merge request. v2.7.2 uses new fixed power-tasks.