Conversation
|
If it is really the calls to As the list of all available analyses is typically small, does not change during analysis, and numbered starting at zero, one could think about generating a |
I've been thinking about this as well, but also the fact that the whole assoc list representation in MCP might need overhauling, for example to use |
|
On sv-benchmarks there's not much of a difference, maybe ~2% improvement: But there also isn't big multithreaded benchmarks there, so the differences aren't as pronounced as in #571. |
|
I would merge this after #578 because there are major conflicts between the two. |
05f3885 to
958e2a0
Compare
|
I now rebased this on top of #578 and also simplified the implementations: instead of using exceptions to escape the fold, I'm now just using I also benchmarked this new version and it's much more impressive than the previous version. This compared to #578There's an additional ~10% speedup: #578 and this compared to master |
|
Nice! I'm always amazed at how much time we seem to waste in non-obvious places. |



This PR is an attempt to optimize the following
MCPdomain/context/access functions:equalcompareleqis_topis_botmay_raceThe previous implementations used folds, which inevitably had to iterate over the entire list each time. Even though the folding functions themselves used the short-circuiting binary operators, this didn't short-circuit much. Moreover, all the inefficient
List.assoccalls were still happening just to pass the corresponding arguments to the folding function (which in the short-circuiting case didn't even use them).These
assocs are a pain because as the fold goes down the list, each correspondingassocneeds to go through more of the other list. Overall, this means O(n²) complexity.This PR implements alternative short-circuitable folds for
MCP, which abort the list iteration via local exception to short-circuit. It not only avoids the unnecessary list tail iteration, but also all theassoccalls that would unnecessarily happen there.This is quite relevant because while profiling slow race warning performance that @vesalvojdani noticed, it turns out that 30% of race warning time is just spent on
MCPAccess.A.comparewhile manipulating sets of accesses.I'm speculating that this might even have general performance improvement since path-sensitivity also uses sets of
MCP.Dvalues.TODO