In some simple examples run on slc3 G4IonTable::IsLightIon ends up eating most of the cpu due to too many string creation Although more modern compilers may mitigate the problem I wish to suggest to modify the code as follows (I think that for all practical use cases a linear search is better than a binary one) #include <algorithm> G4bool G4IonTable::IsLightIon(G4ParticleDefinition* particle) const { static const std::string names[] = { "proton", "neutron", "alpha", "deuteron", "triton", "He3", "GenericIon"}; // return true if the particle is pre-defined ion return std::find(names, names+7, particle->GetParticleName())!=names+7; }
Thanks. The fix will be included in release 8.2.