tikv / yatp

Yet another thread pool in rust for both callbacks or futures.
Apache License 2.0
135 stars 32 forks source link

*: introduce coarse time #28

Closed BusyJay closed 4 years ago

BusyJay commented 4 years ago

Scheduling algorithm doesn't require accurate time measurement, so use coarse time to reduce overhead. Benchmark shows that there are about 10% improvement in all cases.

sticnarf commented 4 years ago

For the same reason stated here (https://github.com/tikv/tikv/pull/6375#discussion_r363340565), I worry using coarse time for schedule_time will lead to unexpected high latency.

I don't think it is necessary to chance the cleanup time to coarse time. recent() is right for reducing the cost of Instant::now().