Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve performance of element handling #1601
As described over at openbabel/enhancement-proposals#4.
Briefly, the old element handling code had some performance problems. I have written a faster replacement. It has the following additional benefits:
Timing comparison: get the symbol for elements 1 to 100 and convert back to atomic number (repeat x10000). 0.82s old vs 0.02s new. A more realistic conversion is to just do carbon: 0.14s old vs 0.01s new.
Updated timings, for the record, with 3 signif figures and 10x more iterations:
Timing comparison: get the symbol for elements 1 to 100 and convert back to atomic number (repeat x100000). 8.05s old vs 0.187s new. A more realistic conversion is to just do carbon: 1.34s old vs 0.078s new.
referenced this pull request
Aug 21, 2017
All the simple helper functions (IsSulfur, IsHydrogen, etc) which are easier to read and less error-prone than checking atomic numbers. Of course, I already changed my code to be compatible, but it would have been nice to not have to. This hurts backwards compatibility and I don't see the advantage.