-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve pull * fix lint error * refactor to use hasOwn --------- Co-authored-by: Sojin Park <raon0211@gmail.com>
- Loading branch information
Showing
2 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { bench, describe } from 'vitest'; | ||
import { pull as pullToolkit } from 'es-toolkit/compat'; | ||
import { pull as pullLodash } from 'lodash'; | ||
|
||
describe('pull array size 100', () => { | ||
const array = [...Array(100)].map((_, i) => i); | ||
const even = [...Array(50)].map((_, i) => i * 2); | ||
|
||
bench('es-toolkit/pull', () => { | ||
pullToolkit([...array], even); | ||
}); | ||
|
||
bench('lodash/pull', () => { | ||
pullLodash([...array], ...even); | ||
}); | ||
}); | ||
|
||
describe('pull array size 1000', () => { | ||
const array = [...Array(1000)].map((_, i) => i); | ||
const even = [...Array(500)].map((_, i) => i * 2); | ||
|
||
bench('es-toolkit/pull', () => { | ||
pullToolkit([...array], [...even]); | ||
}); | ||
|
||
bench('lodash/pull', () => { | ||
pullLodash([...array], ...even); | ||
}); | ||
}); | ||
|
||
describe('pull array size 10000', () => { | ||
const array = [...Array(10000)].map((_, i) => i); | ||
const even = [...Array(5000)].map((_, i) => i * 2); | ||
|
||
bench('es-toolkit/pull', () => { | ||
pullToolkit([...array], [...even]); | ||
}); | ||
|
||
bench('lodash/pull', () => { | ||
pullLodash([...array], ...even); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters