Skip to content

Commit

Permalink
Merge pull request #149 from lopezca/feature/improve-insert-speed
Browse files Browse the repository at this point in the history
Accelerate insertion of large number of elements
  • Loading branch information
gcotelli authored Jan 20, 2024
2 parents 9c7ad46 + 07cad4d commit c294e22
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Glorp/ObjectTransaction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,20 @@ in VA, which might have side-effects. This feature's tests have been altered to

{ #category : #registering }
ObjectTransaction >> registeredObjectsDo: aBlock [
"Iterate over all our objects. Note that this will include objects without descriptors. Be sure we're iterating over a copy of the keys, because this will add objects to the undoMap. Allow the block to return a collection which we will then add to the list of things to process, until there's nothing further"
"Iterate over all our objects. Note that this will include objects without descriptors. Be sure we're iterating over a copy of the keys, because `aBlock` may add objects to the undoMap. Allow the block to return a collection which we will then add to the list of things to process, until there's nothing further"

| newAdditions previousVersion |
newAdditions := undoMap keys.
previousVersion := newAdditions.
previousVersion := newAdditions asSet.
[newAdditions isEmpty]
whileFalse:
[newAdditions do: aBlock.
newAdditions := OrderedCollection new.
undoMap
keysDo:
[:eachKey | (previousVersion includes: eachKey) ifFalse: [newAdditions add: eachKey]].
newAdditions isEmpty ifFalse: [previousVersion := undoMap keys]]
newAdditions ifNotEmpty: [previousVersion addAll: newAdditions ]
]
]

{ #category : #registering }
Expand Down

0 comments on commit c294e22

Please sign in to comment.