When withdrawing all locks in quick sort approach, the gas consumption slightly increases since we still use deleteItem library function.
Also, when withdrawing a partial amount of locks, the gas consumption is less since i would say that the resulting order of the array after deletion favours the amount of swaps done when sorting.
Also, quick sort approach costs more gas when deploying
The gas prices difference are not that significant so i'm okay going with one approach or the other.
Maybe there is another alternative that haven't considered
Includes suggestions from @bingen.
This is the approach suggested from @willjgriff where we shift all locks that haven't been unlocked yet after deletion.
Thought of an alternative approach where we perform a quickSort after deleting the items. PR with the alternative approach: https://github.com/1Hive/time-lock-app/pull/78
Regarding gas consumption:
This approach:
Quick sort approach:
When withdrawing all locks in quick sort approach, the gas consumption slightly increases since we still use
deleteItem
library function. Also, when withdrawing a partial amount of locks, the gas consumption is less since i would say that the resulting order of the array after deletion favours the amount of swaps done when sorting. Also, quick sort approach costs more gas when deployingThe gas prices difference are not that significant so i'm okay going with one approach or the other.
Maybe there is another alternative that haven't considered