Draft: Speed up cluster counting on the C++ side

Once !510 (merged) is merged, the great majority of the time on the C++ side in a MC simulation is spent in the ClusterCounts module, counting how the clusters are occupied. This MR suggests a minor modification to this counting that seems to reduce the time spent on the C++ by 10-20 %, both in the change calculation and in the total energy calculation. It introduces a temporary map such that another map can be filled more in chunks (I'm not quite sure why the present version is faster, please see Changes and judge yourself).

Benchmark

Based on a slightly modified benchmark/benchmark_ce_calculator.py, I get speedup like this:

timing

Not super-impressive but since this is typically more than 50 % of the total runtime in mchammer, we would save a few minutes per hour. It seems like the effect is stronger for small systems, but I don't think there is a risk that it will degrade performance for super-large systems.

Pending !510 (merged)

Merge request reports

Loading