avoid isinstance() checks in version comparisons for a mild performance improvement#51367
avoid isinstance() checks in version comparisons for a mild performance improvement#51367cosmicexplorer wants to merge 3 commits intospack:developfrom
Conversation
4d8c856 to
96b2473
Compare
|
Tests are failing on matching |
of what exactly? I see a 3.5% speedup in |
|
That's confusing. I had been getting some pretty reliable results from switching over to |
9ff8642 to
3ab1b43
Compare
|
Like, I have two |
|
Kind of upset about this. I was at first still getting about an 11% improvement (after running several times to alleviate e.g. page cache issues) but that's not happening anymore either and I'm getting about the performance you describe as well. I had been getting 50-second runtimes extremely reliably and I don't know where those were coming from now. |
|
Solver performance is deterministic for fixed input, but can easily be 2x slower if some new fact is added or the same facts are presented in a different order. For benchmarking of the Python side you can best look at "setup" reported by For end-to-end performance testing it's best to use a statistical test, see this repo: https://github.com/spack/spack-benchmark. It's very time consuming to run a full benchmark with multiple samples per spec (i.e. multiple shuffles of input data), so in your case I would just look at "setup" time. |
cf1186b to
3ab1b43
Compare
3ab1b43 to
71c05e2
Compare
Signed-off-by: Danny McClanahan <[email protected]>
Signed-off-by: Danny McClanahan <[email protected]>
Signed-off-by: Danny McClanahan <[email protected]>
By using a cache for Spec objects and reducing the number of copies of Spec objects being done. Combined with spack#51367 and the reduced install task sleep time from spack#51491 this reduces the time for a no-op install of a development environment with 94 packages (including dependencies) from 8s to 2.8s for me. It also provides a similar reduction in time for `spack build-env --dump env.txt mypkg` which we frequently use to start a shell with the build environment. Signed-off-by: Victor Brunini <[email protected]>
Combined with spack#51535, spack#51536, spack#51367 and the reduced install task sleep time from spack#51491 this reduces the time for a no-op install of a development environment with 94 packages (including dependencies) from 8s to 2.8s for me. It also provides a similar reduction in time for `spack build-env --dump env.txt mypkg` which we frequently use to start a shell with the build environment. Signed-off-by: Victor Brunini <[email protected]>
Problem
See #51365.
isinstance()checks in version comparisons are a mild performance hotspot.Solution
Convert every
isinstance()check inversion_types.pyinto anispointer equality againsttype(...).Result
Very mild performance improvment (I'm seeing 11%, but it depends upon the run).