Tests:
  • Using the spread operator

    x
     
    function passFn(obj) {
        console.log(obj);
    }
    const firstObject = {
        id: 10737,
        developer: 'СТРАНА Девелопмент',
        residentialComplexName: 'asd',
        residentialComplexLink: 'asd',
        city: 'Москва',
        station: '',
        address: '',
        releaseDate: '',
    };
    const secondObject = {
        sumMin: '',
        sumMax: '',
        image: '',
        roomsCount: '',
        squareMeters: '',
        apartSumMin: '',
        apartSumMax: '',
        regulationLink: 'asd',
        presentationDeveloperLink: '',
        presentationComplexLink: 'asd',
    };
    const finalObject = {
        ...firstObject,
        ...secondObject,
    };
    passFn(finalObject);
  • Using spread to params

     
    function passFn(obj) {
        console.log(obj);
    }
    const firstObject = {
        id: 10737,
        developer: 'СТРАНА Девелопмент',
        residentialComplexName: 'asd',
        residentialComplexLink: 'asd',
        city: 'Москва',
        station: '',
        address: '',
        releaseDate: '',
    };
    const secondObject = {
        sumMin: '',
        sumMax: '',
        image: '',
        roomsCount: '',
        squareMeters: '',
        apartSumMin: '',
        apartSumMax: '',
        regulationLink: 'asd',
        presentationDeveloperLink: '',
        presentationComplexLink: 'asd',
    };
    passFn({ ...firstObject, secondObject });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Using the spread operator
    Using spread to params

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103 on Windows
View result in a separate tab
Test name Executions per second
Using the spread operator 80689.8 Ops/sec
Using spread to params 173701.8 Ops/sec