[libcxx-commits] [libcxx] [libc++][lit] Atomically update the persistent cache (PR #66538)

Alexander Richardson via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 18 08:57:05 PDT 2023


================
@@ -69,8 +69,14 @@ def f(config, *args, **kwargs):
             if cacheKey not in cache:
                 cache[cacheKey] = function(config, *args, **kwargs)
                 # Update the persistent cache so it knows about the new key
-                with open(persistentCache, "wb") as cacheFile:
+                # We write to a PID-suffixed file and rename the result to
----------------
arichardson wrote:

That definitely works for me, but the comment at the top of the file suggests that reusing it between runs is important:

```
 We also store the cache for a given function persistently across invocations
    of Lit. This dramatically speeds up the configuration of the test suite when
    invoking Lit repeatedly, which is important for developer workflow.
```

Adding the PID would break this re-use so I'm not sure if that is acceptable?

https://github.com/llvm/llvm-project/pull/66538


More information about the libcxx-commits mailing list