Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#89 closed defect (fixed)

Atom deletion is very slow

Reported by: Tom Goddard Owned by: Eric Pettersen
Priority: major Milestone:
Component: Performance Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: chimera

Description

When deleting atoms from a molecule each atom delete causes all DestructionObserver objects to be called. This leads to extremely slow order N*N speed when deleting the atom from Python arrays of atoms because for each deleted atom, the entire array has to be scanned to delete that atom. There is a Python array of all the atom pointers for the graphics.

What would help is having an AtomicStructure delete_atoms() method that can take a whole list of atoms and produce a single DestructionObserver call.

I don't have measured times for deleting many atoms because other bugs are causing crashes when deleting atoms.

Change History (4)

comment:1 by Eric Pettersen, 10 years ago

Resolution: fixed
Status: newclosed

Implemented delete_atoms(). Still need to properly delete pseudobonds.

comment:2 by Tom Goddard, 10 years ago

Resolution: fixed
Status: closedreopened

Deleting chain 0 (65,000 atoms) from pdb 1jj2 (100,000) takes 95 seconds with the new delete_atoms() call. Investigation shows the destruction observers are only called once on 131,000 items (atoms and bonds) and that processing is handled instantly (fraction of a second). All the time is in the actual C++ delete_atoms(). That code removes the atoms and bonds from a vector one at a time. It searches linearly through the vector then erases the element causing all the items in the vector to be shifted down in memory. This is requiring on the order of 2 * 65,000 * 100,000 = 13 billion operations for search and delete, so it is no surprise that it is slow. It is probably necessary to use a std::set of deleted atoms, make a set of deleted bonds, then do one pass on the relevant vectors to eliminate all the deleted atoms and bonds, by building new vectors of the surviving atoms and bonds.

comment:3 by Eric Pettersen, 10 years ago

Resolution: fixed
Status: reopenedclosed

comment:4 by Eric Pettersen, 10 years ago

Component: Molecular DataPerformance
Note: See TracTickets for help on using tickets.