ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

Memoize `count-cpus`? #153

Closed Ambrevar closed 1 year ago

Ambrevar commented 1 year ago

I was hit by a performance issue: count-cpus in a tight loop... I suppose because of a system call.

Considering the number of CPUs is unlikely to change at runtime, maybe memoize the function?

ruricolist commented 1 year ago

It's memoized by default now, with an option to run it without memoization.

Ambrevar commented 1 year ago

Excellent, thanks!