Skip to content

Smaller/more performant? #14

Open
Open
@jimmywarting

Description

@jimmywarting

I was thinking maybe it could be possible to use Set instead to do the same thing...
A benchmark for it maybe?

var a = ['a', 'b', 'c', 'd'];
var b = ['b', 'c'];

var set = new Set(a)
b.forEach(a => set.delete(a))
Array.from(set) // => ['a', 'd']

Also in many situations it's wasteful to cast the set into an array... ppl only do it to keep the same signature and never used set in the first place

curious to see a benchmark for this native solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions