__spread Performance Issues
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- performance
Research direction
Start by reproducing the benchmark in the issue and inspect the tslib.__spread helper it exercises. Compare its results and timing with the native spread, Array.prototype.push.apply, and concat cases shown; done would require an agreed performance improvement without changing behavior.
Written by the indexing model from the issue text.
Description
__spread
var tslib = require("tslib");
const { concat } = require('lodash')
var testPushES6 = function(abc) {
var arr1 = [1,2,3,-1]
var arr2 = [4,5,6,7,8,9,10,12,13,14,15,16,17,18,29,30,31,32,33,34,35,36,37,38,39,40]
const arr = arr1.push(...arr2)
}
var testPush = function(abc) {
var arr1 = [1,2,3,-1]
var arr2 = [4,5,6,7,8,9,10,12,13,14,15,16,17,18,29,30,31,32,33,34,35,36,37,38,39,40]
Array.prototype.push.apply(arr1, arr2)
}
var testPush2 = function(flag) {
var arr1 = [1,2,3,-1]
var arr2 = [4,5,6,7,8,9,10,12,13,14,15,16,17,18,29,30,31,32,33,34,35,36,37,38,39,40]
arr1.push.apply(arr1, tslib.__spread(arr2));
}
var testConcat = function(abc) {
var arr1 = [1,2,3,-1]
var arr2 = [4,5,6,7,8,9,10,12,13,14,15,16,17,18,29,30,31,32,33,34,35,36,37,38,39,40]
var arr = arr1.concat(arr2)
}
var testConcat = function(abc) {
var arr1 = [1,2,3,-1]
var arr2 = [4,5,6,7,8,9,10,12,13,14,15,16,17,18,29,30,31,32,33,34,35,36,37,38,39,40]
var arr = concat(arr1, arr2)
}
var count = 1000000
var date = Date.now()
for (var i = 0; i < count; i++) {
testPushES6()
}
// 136
console.log(Date.now() - date)
var date = Date.now()
for (var i = 0; i < count; i++) {
testPush()
}
// 139
console.log(Date.now() - date)
var date = Date.now()
for (var i = 0; i < count; i++) {
testPush2()
}
// 1005
console.log(Date.now() - date)
var date = Date.now()
for (var i = 0; i < count; i++) {
testConcat()
}
// 310
console.log(Date.now() - date)
var date = Date.now()
for (var i = 0; i < count; i++) {
testConcat2()
}
// 810
console.log(Date.now() - date)
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/tslib
-
Difficulty 1/5 Under an hour Newbie friendliness 1/100
-
question
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/docs#46222 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: config area: skills type: chore upstream: brain-kit
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
enhancement priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug escritorio mapa
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
marcosferr/reporte-ciudadano#4 · 1 comment ·
-
area: material/sort gemini-triaged needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
angular/components#33933 ·
Maintainers usually reply within 1 day