diff --git a/CHANGELOG.md b/CHANGELOG.md index f6a93c73c09d5f70b981c1562ed409f4238efb05..008c8afef15c994b5238daaf110f5c519c047f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Note that since we don't clearly distinguish between a public and private interf - Hide ``includeParent`` option from gaussian-surface visuals (not particularly useful) - Improved ``StructureElement.Loci.size`` performance (for marking large cellpack models) - Fix new ``TransformData`` issues (camera/bounding helper not showing up) +- Improve marking performance (avoid superfluous calls to ``StructureElement.Loci.isWholeStructure``) ## [v2.2.2] - 2021-08-11 diff --git a/src/mol-repr/structure/complex-representation.ts b/src/mol-repr/structure/complex-representation.ts index 01d918977df11d55f15942e22277ba7fa730ca0d..5c01237fb7c102ef746c3020e8a31da45d212575 100644 --- a/src/mol-repr/structure/complex-representation.ts +++ b/src/mol-repr/structure/complex-representation.ts @@ -14,7 +14,7 @@ import { getNextMaterialId, GraphicsRenderObject } from '../../mol-gl/render-obj import { Theme } from '../../mol-theme/theme'; import { Task } from '../../mol-task'; import { PickingId } from '../../mol-geo/geometry/picking'; -import { EmptyLoci, Loci, isEveryLoci, isDataLoci } from '../../mol-model/loci'; +import { EmptyLoci, Loci, isEveryLoci, isDataLoci, EveryLoci } from '../../mol-model/loci'; import { MarkerAction, MarkerActions } from '../../mol-util/marker-action'; import { Overpaint } from '../../mol-theme/overpaint'; import { StructureParams } from './params'; @@ -77,6 +77,10 @@ export function ComplexRepresentation<P extends StructureParams>(label: string, if (!Structure.areRootsEquivalent(loci.structure, _structure)) return false; // Remap `loci` from equivalent structure to the current `_structure` loci = Loci.remap(loci, _structure); + if (StructureElement.Loci.is(loci) && StructureElement.Loci.isWholeStructure(loci)) { + // Change to `EveryLoci` to allow for downstream optimizations + loci = EveryLoci; + } } else if (!isEveryLoci(loci) && !isDataLoci(loci)) { return false; } diff --git a/src/mol-repr/structure/units-representation.ts b/src/mol-repr/structure/units-representation.ts index d784e37afd272dbe4c730477e320f667bc850ba3..668a23f47961c4918d48c6dfd9127cabcd0320c5 100644 --- a/src/mol-repr/structure/units-representation.ts +++ b/src/mol-repr/structure/units-representation.ts @@ -15,7 +15,7 @@ import { getNextMaterialId, GraphicsRenderObject } from '../../mol-gl/render-obj import { Theme } from '../../mol-theme/theme'; import { Task } from '../../mol-task'; import { PickingId } from '../../mol-geo/geometry/picking'; -import { Loci, EmptyLoci, isEmptyLoci, isEveryLoci, isDataLoci } from '../../mol-model/loci'; +import { Loci, EmptyLoci, isEmptyLoci, isEveryLoci, isDataLoci, EveryLoci } from '../../mol-model/loci'; import { MarkerAction, MarkerActions, applyMarkerAction } from '../../mol-util/marker-action'; import { Overpaint } from '../../mol-theme/overpaint'; import { Transparency } from '../../mol-theme/transparency'; @@ -196,6 +196,10 @@ export function UnitsRepresentation<P extends StructureParams>(label: string, ct if (!Structure.areRootsEquivalent(loci.structure, _structure)) return false; // Remap `loci` from equivalent structure to the current `_structure` loci = Loci.remap(loci, _structure); + if (StructureElement.Loci.is(loci) && StructureElement.Loci.isWholeStructure(loci)) { + // Change to `EveryLoci` to allow for downstream optimizations + loci = EveryLoci; + } } else if (!isEveryLoci(loci) && !isDataLoci(loci)) { return false; }