HTML Preparation code:
AخA
 
1
<script src="https://unpkg.com/immutable@4.0.0-rc.12/dist/immutable.min.js"></script>
Tests:
  • array slice

    x
     
    let initArr = new Array(5000).fill(88);
    const limitArr = (arr, limit) => (arr.length > limit ? arr.slice(-limit) : arr);
    for(i=0; i<10000; i++) {
      initArr.push(55, 12, 3);
      initArr = limitArr(initArr, 5000);
    }
  • immutable-js

     
    let initList = Immutable.List();
    initList = initList.push(...(new Array(5000).fill(88)));
    const limitList = (list, limit) => (list.size > limit ? list.takeLast(limit) : list);
    for(i=0; i<10000; i++) {
      initList = limitList(initList.push(55, 12, 3), 5000);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array slice
    immutable-js

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Chrome 91 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
array slice 11.7 Ops/sec
immutable-js 123.5 Ops/sec