Or in other words, should I bother checking whether it already is in the set before attaching it?
$s = new SplObjectStorage();
foreach($arrayOfObjects as $primaryObject) {
$subObject=$primaryObject->getSubObject(); //It is possible that a given instance of $subObject might be used in more than one $primaryObject
if(!$s->contains($subObject)) {
$s->attach($subObject);
}
}