-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Unneeded lock in cache? #1550
Comments
I've tested it locally and now I get ~2.0s total |
On checking this, Thread Santizer detects following in
The Swift Programming Language (Swift 3.1) said in Lazy Stored Properties:
|
I always forget about how awesome Thread Sanitizer is 💯 Luckily, if that's the only issue, it'd be pretty easy to fix: just making it a |
According to Thread Sanitizer, |
It does, but I don't know if it'd be fine to remove the |
Thinking more about this, I think removing the lock might not be the right solution. Maybe in this case would be better to use this approach: https://www.objc.io/issues/2-concurrency/low-level-concurrency-apis/#one-resource-multiple-readers-and-a-single-writer? |
Since we don't need to read updated entry from cache, we may be able to separate read cache instance and write cache instance. |
Fixed in #1551 |
I think this lock is unneeded: https://github.com/realm/SwiftLint/blob/master/Source/SwiftLintFramework/Models/LinterCache.swift#L68
Removing this could bring major performance benefits for the use case of running without any modifications, as it's slower than what I'd expect:
The text was updated successfully, but these errors were encountered: