Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use sync I/O. #4000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged

Use sync I/O. #4000

merged 1 commit into from
May 8, 2025

Conversation

davidmorgan
Copy link
Contributor

@davidmorgan davidmorgan commented May 8, 2025

For #3811.

Use sync I/O for file operations, simplify caching.

Also: when reading as string, check the bytes cache before reading; in some cases this saves a read.

Split out from #3995. It looks like the 10% speedup was due to the sync change (+maybe saving one read) and not the write cache, which makes sense: we could only see a performance benefit of write caching if one generator read the output of another, which is not the case in those benchmarks.

Copy link

github-actions bot commented May 8, 2025

PR Health

@gmpassos
Copy link

gmpassos commented May 8, 2025

Interesting change.

IMHO, this needs to be benchmarked on different hardware, since SSD speed will affect the results (at least it will be interesting to see how). Note that a large project won’t load too much data, as it’s only Dart source code, but it will need to resolve and access hundreds of different files.

(I’m totally ignoring HDDs for real-world cases.)

@davidmorgan davidmorgan marked this pull request as ready for review May 8, 2025 08:23
@davidmorgan davidmorgan requested a review from jensjoha May 8, 2025 08:24
@davidmorgan
Copy link
Contributor Author

Interesting change.

IMHO, this needs to be benchmarked on different hardware, since SSD speed will affect the results (at least it will be interesting to see how). Note that a large project won’t load too much data, as it’s only Dart source code, but it will need to resolve and access hundreds of different files.

(I’m totally ignoring HDDs for real-world cases.)

Sync reads are pretty consistently faster than async reads in Dart; but if we do find a case where async is needed, I suspect the way to do it is to add a "batch read" that uses async rather than this file-by-file API.

For now this is more about reducing complexity of the change to put back write caching :)

@davidmorgan davidmorgan merged commit c0f78f3 into dart-lang:master May 8, 2025
153 of 158 checks passed
@davidmorgan davidmorgan deleted the sync-cache branch May 8, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants