Context
Hot-path code in vol2 uses instanceof PropagatingDataStore to dispatch on DataSource type. instanceof checks have virtual dispatch cost and prevent the JIT from fully optimising tight loops.
Required design
Each DataSource implementation carries an int type() discriminant. Dispatch becomes:
switch (ds.type()) {
case DataSourceTypes.PROPAGATING -> { PropagatingDataStore<?> pds = (PropagatingDataStore<?>) ds; ... }
default -> throw new UnsupportedOperationException("DataSource type not yet supported: " + ds.getClass());
}
The explicit UnsupportedOperationException surfaces any TBD paths immediately rather than silently ignoring them.
Interim state
Until this is implemented, all instanceof checks should have a corresponding else { throw new UnsupportedOperationException("DataSource type not yet supported: " + ds.getClass()); } guard so unknown types don't silently no-op.
Refs #6724
Context
Hot-path code in vol2 uses
instanceof PropagatingDataStoreto dispatch on DataSource type. instanceof checks have virtual dispatch cost and prevent the JIT from fully optimising tight loops.Required design
Each
DataSourceimplementation carries anint type()discriminant. Dispatch becomes:The explicit UnsupportedOperationException surfaces any TBD paths immediately rather than silently ignoring them.
Interim state
Until this is implemented, all instanceof checks should have a corresponding
else { throw new UnsupportedOperationException("DataSource type not yet supported: " + ds.getClass()); }guard so unknown types don't silently no-op.Refs #6724