-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
optimizationImproving speed or space efficiencyImproving speed or space efficiency
Milestone
Description
Consider using the standard .values instead of the custom .toArray. Besides, I'd also suggest to use Set's methods as much as possible since it is implemented as a hashset, which is very efficient, instead of relying on Array's methods which usually take at least linear time.
For example, .intersection could be implemented along the following lines
intersection(s1, s2) {
s3 = new Set();
s1.forEach(value => {
if (s2.has(value)) {
s3.add(value);
}
});
return s3;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
optimizationImproving speed or space efficiencyImproving speed or space efficiency