Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

__spread Performance Issues

Open
#125 2 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/tslib

All issues in microsoft/tslib

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.