Skip to content

Slow performance when reading biso column from bcif #13

Description

@josemduarte

Running this with version 5.0.1:

public class DemoCifReader {

    private static Logger logger = LoggerFactory.getLogger(DemoCifReader.class);

    public static void main(String[] args) throws Exception {
        String pdbId = "9a2f";
        boolean parseBinary = true;

        CifFile cifFile;
        if (parseBinary) {
            cifFile = CifIO.readFromURL(new URL("https://models.rcsb.org/" + pdbId + ".bcif"));
        } else {
            cifFile = CifIO.readFromURL(new URL("https://files.rcsb.org/download/" + pdbId + ".cif"));
        }
        MmCifFile mmCifFile = cifFile.as(StandardSchemata.MMCIF);

        MmCifBlock data = mmCifFile.getFirstBlock();
        AtomSite atomSite = data.getAtomSite();
        FloatColumn biso = atomSite.getBIsoOrEquiv();
        FloatColumn cartnX = atomSite.getCartnX();

        for (int i=0; i<biso.getRowCount(); i++) {
            biso.get(i);
            //cartnX.get(i);

            if (i%1000 == 0) logger.info(".");           
        }
    }
}

Results in a runtime of more than 5 minutes. It goes through 1000 biso values in ~ 1s.

However the full file is parsed in mere milliseconds in 2 alternative scenarios:

  • biso.get(i) is commented out and cartnX.get(i) is executed instead
  • reading CIF instead of BCIF (set parseBinary=false)

Any ideas of what might be happening here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions