cheminfo / openchemlib-js

JavaScript port of OpenChemLib
https://cheminfo.github.io/openchemlib-js/index.html
BSD 3-Clause "New" or "Revised" License
71 stars 21 forks source link

Improve getIDCode() #155

Closed lpatiny closed 1 year ago

lpatiny commented 1 year ago

Creating a Canonizer is time consuming and we should first check if 'getIDCode' is null before creating a new Canonizer.

  public String getIDCode() {
    oclMolecule.ensureHelperArrays(StereoMolecule.cHelperParities);
    return new Canonizer(oclMolecule).getIDCode();
  }

This is true for getIDCode and getIDCodeAndCoordinates

https://github.com/cheminfo/openchemlib-js/blob/f688501392d419a5299d8606d150080222662fc4/src/com/actelion/research/gwt/minimal/JSMolecule.java#L1669-L1677