var arr = [186150, 304120, 367540, 29010, 34890, 7540, 77280, 104470, 78520, 491780, 317940, 431650, 282080, 100020, 33320, 455750, 240000, 153790, 277040, 167980, 358490, 189570, 194620, 151290, 192290, 206010, 178210, 145000, 387030, 431550, 40030, 303860, 413480, 473570, 188400, 435610, 278710, 115710, 284420, 402970, 85940, 180390, 375030, 361990, 300720, 44330, 171720, 74250, 246810, 191170, 175410, 455200, 183900, 366320, 61880, 475560, 245480, 69500, 164800, 2070, 490160, 700, 165270, 287070, 189140, 309770, 60050, 15700, 71800, 275510, 104000, 446420, 279540, 163190, 340770, 182700, 73380, 268420, 413100, 392180, 200660, 404300, 315960, 219970, 450160, 438860, 322320, 104330, 142440, 131210, 316250, 55410, 484790, 320900, 41290, 274110, 277900, 244630, 132990, 488210, 60430, 263660, 90380, 83640, 181370, 468140, 351250, 445020, 446650, 107220, 416790, 365780, 118300, 118370, 203820, 106670, 315660, 114850, 337660, 147460, 448340, 174010, 101400, 351900, 274220, 406350, 142180, 450770, 49200, 348260, 310880, 175570, 404440, 221440, 360780, 174180, 223340, 433660, 252410, 244280, 179060, 497770, 159230, 96400, 47150, 203430, 495130, 354780, 346470, 45080, 359580, 273080, 137770, 444630, 219920, 243560, 33510, 91710, 467320, 300160, 45210, 211850, 382950, 336520, 145680, 89260, 442320, 74190, 396660, 108310, 161570, 133820, 198810, 10510, 341560, 81390, 67430, 147140, 166560, 346790, 266200, 166910, 148730, 234100, 277870, 442170, 260650, 189150, 432080, 209590, 381110, 465030, 475370, 219110, 406460, 474240, 471230, 371110, 310380, 370000, 104890, 5010, 212850, 388650, 190020, 67240, 263790, 97080, 465100, 190450, 354740, 326020, 474050, 392550, 455960, 4320, 388170, 435040, 40440, 49470, 190470, 325010, 94700, 189840, 492690, 323790, 46490, 38430, 456720, 26180, 82270, 479510, 422880, 336180, 178640, 99340, 447800, 383100, 433480, 11590, 177890, 130070, 449070, 35050, 2520, 271450, 105190, 200570, 184370, 415290, 81470, 171590, 476150, 432990, 321210, 12040, 453730, 3340, 108250, 281400, 319390, 382660, 19630, 79150, 177360, 438040, 370560, 210360, 83720, 5870, 232370, 102790, 73560, 190700, 163420, 447420, 430130, 186430, 488310, 414510, 69130, 232950, 407050, 346610, 260300, 394450, 383490, 423730, 156450, 74080, 89490, 127540, 418260, 433280, 216030, 329030, 291960, 157670, 283010, 183960, 45310, 61680, 219390, 290950, 416310, 375930, 190230, 386550, 151530, 410360, 368560, 378020, 64590, 75790, 266320, 385620, 266150, 393430, 437620, 465230, 243920, 212330, 428000, 169080, 169480, 166740, 195330, 1550, 41330, 304330, 191540, 307630, 484140, 18730, 375520, 154030, 356830, 272020, 168250, 486720, 460720, 248270, 19740, 454230, 306660, 202080, 103790, 289160, 50490, 175100, 421360, 157540, 480270, 9110, 257880, 147920, 449180, 84240, 168060, 423860, 183750, 443220, 309910, 128980, 355570, 55080, 446350, 279260, 107630, 403940, 224590, 100470, 418910, 427320, 496920, 165220, 398770, 337980, 7340, 349410, 153780, 411350, 158560, 25550, 460170, 103560, 248580, 277240, 395150, 302190, 495000, 495450, 260040, 185160, 330180, 143730, 44250, 62930, 83880, 73900, 168590, 286570, 285670, 452020, 357620, 156740, 141010, 328620, 243190, 332290, 399080, 396590, 494520, 495450, 332350, 42520, 378510, 422040, 160260, 354970, 415700, 463870, 425500, 190220, 247030, 130700, 401810, 38870, 134100, 347140, 39650, 142730, 212730, 467360, 382580, 283430, 409130, 272770, 170480, 312120, 14550, 65790, 87420, 456030, 43000, 113650, 153930, 94460, 343980, 103540, 469220, 117600, 107980, 209390, 348680, 182200, 287900, 496250, 335200, 403820, 124250, 499170, 26850, 360290, 56440, 363430, 245940, 318540, 302750, 10170, 83970, 185910, 349450, 45100, 15740, 347410, 132030, 15220, 191470, 379390, 167580, 1750, 274340, 461850, 432750, 320500, 131950, 285430, 480670, 433100, 145790, 65270, 150, 442530, 77370, 76680, 87210, 265780, 407520, 37490, 379780, 353040, 224520, 5760, 495890, 141710, 479330, 152640, 212460, 312890, 438220, 210390, 355060, 153220, 235900, 46740, 387120, 343770, 361880, 318950, 264200, 361070, 100490, 77430, 7180, 332570, 347020, 341350, 424870, 39550, 437610, 138970, 291570, 264470, 102820, 147940, 430570, 478020, 84420, 200260, 338030, 275380, 119800, 262180, 362360, 34460, 357630, 244320, 225840, 164930, 27130, 232910, 440590, 249900, 391270, 122810, 444930, 308700, 329640, 126580, 8450, 197550, 217050, 481320, 161880, 50470, 213710, 289890, 226910, 488920, 151680, 255550, 364860, 610, 50530, 38210, 414600, 324620, 334040, 484520, 319700, 69400, 55140, 28530, 224660, 99320, 405240, 13290, 458020, 415620, 234920, 69020, 320650, 456830, 91070, 292290, 134730, 494130, 476640, 343120, 151860, 176120, 213230, 243780, 273420, 432010, 61520, 491380, 390900, 275670, 376410, 479170, 203240, 262890, 374350, 82020, 285710, 285060, 130040, 433630, 480550, 132840, 331310, 87890, 391510, 464680, 224350, 51830, 68650, 278940, 439950, 375700, 478220, 155030, 436380, 429400, 378130, 486170, 274830, 152220, 166110, 17680, 334300, 384310, 431150, 105100, 157410, 434090, 97800, 496790, 320870, 464680, 265050, 264710, 220300, 368500, 439570, 333860, 183260, 359610, 107190, 328380, 395160, 180450, 499510, 400320, 331140, 66210, 310330, 200830, 269000, 240830, 365590, 369490, 297890, 378400, 338620, 122830, 237250, 284620, 211020, 321920, 142970, 354890, 482850, 242070, 19120, 422830, 498760, 53160, 245330, 189610, 366450, 349520, 27980, 395890, 24090, 432220, 440840, 301740, 301630, 228330, 103540, 434550, 293490, 464430, 432390, 168540, 276430, 440780, 147030, 257140, 28280, 263690, 44470, 5100, 105690, 303960, 251850, 394710, 228040, 280640, 61450, 317590, 413760, 173110, 322140, 200060, 124950, 423920, 103080, 144600, 65680, 121870, 327210, 168070, 235810, 292830, 448470, 299990, 76020, 256480, 5050, 320120, 417530, 218130, 343390, 57180, 151470, 472440, 76570, 80900, 438950, 261710, 483940, 144330, 224280, 245160, 166890, 158480, 119790, 219830, 287330, 310220, 132710, 151230, 345570, 218220, 154500, 126820, 107670, 125440, 463890, 494630, 276060, 412400, 313440, 290580, 29410, 107190, 309110, 4960, 306200, 310850, 267300, 19400, 93380, 213170, 46870, 49390, 306710, 287720, 121840, 180650, 249210, 56080, 164960, 256810, 278010, 316040, 228100, 36660, 275820, 189890, 314870, 248690, 478870, 158250, 69850, 139120, 163100, 338190, 193810, 64790, 281040, 417310, 351090, 471040, 4050, 343250, 445540, 405270, 1700, 395180, 333000, 477390, 70720, 19440, 432680, 219090, 291770, 25650, 414490, 374860, 400090, 310470, 496150, 47450, 338160, 180400, 448450, 64110, 25700, 222290, 361850, 384390, 361830, 79630, 330990, 76940, 88910, 357400, 38980, 58880, 161130, 231030, 348120, 113630, 474070, 192030, 382210, 33300, 478400, 271980, 488590, 378040, 301440, 18880, 237850, 445730, 283540, 287190, 76200, 325930, 400920, 470800, 203230, 102920, 240310, 249160, 316400, 39850, 466650, 282080, 172530, 376730, 422120, 87900, 410110, 467760, 220500, 444870, 466760, 353980, 160250, 206500, 265890, 479810, 114250, 359720, 377700, 147550, 86470, 231200, 53380, 484130, 245930, 23430, 30560, 346130, 296700, 468390, 203860, 298580, 469700, 148470, 409630, 279670, 246600, 353170, 384430, 204790, 258340, 145440, 214030, 437080, 252640, 187190, 143310, 288530, 271930, 57210, 271950, 389050, 107150, 376270, 395710, 323150, 313110, 310940, 266470, 413290, 40180, 369500, 364020, 111670, 77520, 116810, 264390, 462500, 190680, 180310, 322920, 439000, 75850, 358180, 471600, 160780, 125880, 41790, 324230, 457310, 46170, 180840, 339750, 111650, 106300, 6210, 133190, 284210, 243000, 356130, 379030, 75130, 51050, 148890, 284270, 133780, 439400, 345610, 289270, 81960, 102900, 348290, 320790, 475840, 399790, 136490, 48730, 289440, 224350, 284150, 394460, 441410, 338970, 332320, 346030, 234180, 333860, 91470]
var a = arr.sort();
var min = a[0];
var max = a[1];
var min = Math.min(arr);
var max = Math.max(arr);
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Array.sort | |
Math min and max |
Test name | Executions per second |
---|---|
Array.sort | 80644.5 Ops/sec |
Math min and max | 10326.5 Ops/sec |
It seems like we're dealing with a JavaScript benchmarking script, and the task is to extract insights from the provided data.
The script appears to be comparing two approaches for finding the minimum and maximum values in an array:
Array.sort()
: Sorting the entire array and taking the first and last elements as the min and max.min()
and Math max()
: Using the spread operator (...
) to pass the array elements as separate arguments to these functions.To answer your question, I'll provide some observations based on the latest benchmark result:
The script is comparing two sorting algorithms:
Array.sort()
: A built-in JavaScript method that modifies the original array in-place.min()
and Math max()
: Using these functions to find the minimum and maximum values without modifying the original array.From the latest benchmark result, we can see:
Array.sort()
, Firefox 83 on Windows achieves approximately 80,644.51 executions per second.min()
and Math max()
, Firefox 83 on Windows achieves around 10,326.48 executions per second.This suggests that the built-in Array.sort()
method is significantly faster than using these functions to find the minimum and maximum values in an array.
Some potential additional insights:
Please let me know if you'd like me to explore any specific aspect of this benchmarking script further!