diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-10-30 16:51:13 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-10-30 17:04:09 -0700 |
| commit | 30b8b29f88362d18ea6523a859b29f7bc6dec622 (patch) | |
| tree | 87f7a6cc6bed6f9cd51a68bb7c143af393028a71 /lib/std/Thread/Condition.zig | |
| parent | a5c96c49d0eedbce40ad9a58d1b236f1eaeabd03 (diff) | |
| download | zig-30b8b29f88362d18ea6523a859b29f7bc6dec622.tar.gz zig-30b8b29f88362d18ea6523a859b29f7bc6dec622.zip | |
re-apply "Fix C include files not being in `whole` cache (#11365)"
This reverts commit 06310e3d4eb47fed88b175891cb5865bb050f020, reapplying
commit a430630002bf02162ccbf8d3eb10fd73e490cefd.
I deeply apologize to @moosichu and those affected by this bug. The
original fix was actually fine. When I reverted it, I misremembered
how the Cache API works. I thought the fix was going to introduce
nondeterminism into the hash, but I forgot that the order of files in
the manifest doesn't actually matter when checking for a cache hit.
Actually, it does matter a little bit. This fix has a subtle downside
which is that it does introduce the possibility of false negatives when
checking for cache hits of 2+ iterations ago. For example, if the code
goes from "foo", to "bar", and then back to "foo", it may look like a
cache miss when it should have been a hit because 2 iterations ago the
code was the same. However, this is an uncommon use case, and all it
does is cause a bit of wasted time and disk space. That said, my
suggestion from earlier still applies and would be a nice follow-up
enhancement to this fix:
The proper solution to this is to, in whole cache mode, append the hash
inputs to some data structure, and then after the compilation is
complete, do some kind of sorting on the hash inputs so that they will
be the same order every time, then apply them in sequence. No lock on
the Cache object is needed for this scheme.
closes #11063
Diffstat (limited to 'lib/std/Thread/Condition.zig')
0 files changed, 0 insertions, 0 deletions
