dart-archive / shelf_static

archived repo
https://github.com/dart-lang/shelf/tree/master/pkgs/shelf_static
BSD 3-Clause "New" or "Revised" License
24 stars 24 forks source link

Don't use *Sync methods in filesystem access. #25

Closed isoos closed 6 years ago

isoos commented 6 years ago

They are blocking other processing that could go on while the file or directory is being read.

kevmoo commented 6 years ago

Thoughts, @nex3 ?

I'm happy to go all async here – but that also has runtime costs and makes debugging harder.

Maybe just use async when the operation could be long?

nex3 commented 6 years ago

My experience has generally been that the overhead of async IO is high enough that it doesn't provide a meaningful performance benefit, even in the presence of some amount of parallelism. I wouldn't advise doing this without benchmarks that show a concrete benefit.

isoos commented 6 years ago

I stand corrected. The change was easy (I can send PR if interested), but the performance benefits were not measurable on my Linux server with a fast SSD, and were under 1-5% difference between the two. Not sure if a slower HDD would show a difference. On a Mac notebook the benchmark's result varied more than 30% between consecutive measurements, so I've discarded that.

srawlins commented 6 years ago

All use of sync* has been removed from this repo.