Skip to content

Commit

Permalink
batch.clear() improvement
Browse files Browse the repository at this point in the history
Is there a specific reason to use `.splice(0, this.length)` instead of simply setting `length = 0`? If there's not the latter is faster...
  • Loading branch information
exside authored Sep 18, 2024
1 parent 705204d commit a894aa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion write.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ class Batch extends Array {
this.push({ type: 'del', key });
}
clear() {
this.splice(0, this.length);
this.length = 0;
}
write(callback) {
return this.callback(this, callback);
Expand Down

0 comments on commit a894aa0

Please sign in to comment.