Always disable sync in SQLite cache#21184
Conversation
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
| # This is a bit unfortunate (as we may get corrupt cache after e.g. Ctrl + C), | ||
| # but without this flag, commits are *very* slow, especially when using HDDs, | ||
| # see https://www.sqlite.org/faq.html#q19 for details. | ||
| db.execute("PRAGMA synchronous=OFF") |
There was a problem hiding this comment.
I guess we could probably get away with having synchronous enabled on macOS, since they all have had SSDs for a long time now, but since we'll need this for parallel checking, it makes more sense to keep things consistent.
This disables |
I don't know the details, but probably yes.
It will likely just crash on startup. If this will become a problem we can detect this condition and manually delete the cache. |
|
I agree that implementing automatic recovery from a corrupt cache could be worth it. However, I believe disabling fsync mostly impacts situations where power is lost or the system is hard rebooted -- just killing mypy shouldn't be a problem? |
That matches my expectation. |
Fixes #21176
This seems to resolve all the HDD performance issues. Although this makes cache less durable, this is fine, as FS is not perfect in this sense either (and it doesn't really need to be that durable).