@ 2016-01-25T02:59:21Z <?php
class A
{
}
class First
{
protected $collection;
public function __construct(array $items)
{
$this->collection = (function (A ...$items) {
return $items;
})(...$items);
}
};
class Second
{
protected $collection;
public function __construct(array $items)
{
foreach ($items as $item) {
if (!($item instanceof A)) {
throw new Exception();
}
}
$collection = $items;
}
};
$given = [
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
new A(),
];
$start = microtime(true);
for ($i = 0; $i < 10000; $i++) {
new First($given);
}
echo "First: " . (microtime(true) - $start) . PHP_EOL;
$start = microtime(true);
for ($i = 0; $i < 10000; $i++) {
new Second($given);
}
echo "Second: " . (microtime(true) - $start) . PHP_EOL;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.3.6 First: 0.053695917129517
Second: 0.057333946228027
Output for 8.3.5 First: 0.071646928787231
Second: 0.058818101882935
Output for 8.3.4 First: 0.051084041595459
Second: 0.058692932128906
Output for 8.3.3 First: 0.052013874053955
Second: 0.057821989059448
Output for 8.3.2 First: 0.028140068054199
Second: 0.030789852142334
Output for 8.3.1 First: 0.028944969177246
Second: 0.031483173370361
Output for 8.3.0 First: 0.056432008743286
Second: 0.030927896499634
Output for 8.2.18 First: 0.059537172317505
Second: 0.06190299987793
Output for 8.2.17 First: 0.060781955718994
Second: 0.074576854705811
Output for 8.2.16 First: 0.06423282623291
Second: 0.070789813995361
Output for 8.2.15 First: 0.061868906021118
Second: 0.030494928359985
Output for 8.2.14 First: 0.032896995544434
Second: 0.039066076278687
Output for 8.2.13 First: 0.027669906616211
Second: 0.031093120574951
Output for 8.2.12 First: 0.029145002365112
Second: 0.029922008514404
Output for 8.2.11 First: 0.055548191070557
Second: 0.07538104057312
Output for 8.2.10 First: 0.038631916046143
Second: 0.042711019515991
Output for 8.2.9 First: 0.04383397102356
Second: 0.042507886886597
Output for 8.2.8 First: 0.042487859725952
Second: 0.042643070220947
Output for 8.2.7 First: 0.042694091796875
Second: 0.043231010437012
Output for 8.2.6 First: 0.040746927261353
Second: 0.043056964874268
Output for 8.2.5 First: 0.042958974838257
Second: 0.042370080947876
Output for 8.2.4 First: 0.040037870407104
Second: 0.042712926864624
Output for 8.2.3 First: 0.044275999069214
Second: 0.045809984207153
Output for 8.2.2 First: 0.039452791213989
Second: 0.04217791557312
Output for 8.2.1 First: 0.038676023483276
Second: 0.042321920394897
Output for 8.2.0 First: 0.042166948318481
Second: 0.042051076889038
Output for 8.1.28 First: 0.052304029464722
Second: 0.056008100509644
Output for 8.1.27 First: 0.02888011932373
Second: 0.030224800109863
Output for 8.1.26 First: 0.038004159927368
Second: 0.034102201461792
Output for 8.1.25 First: 0.045190811157227
Second: 0.029817819595337
Output for 8.1.24 First: 0.054112911224365
Second: 0.073100090026855
Output for 8.1.23 First: 0.040400981903076
Second: 0.041905879974365
Output for 8.1.22 First: 0.041347980499268
Second: 0.041729927062988
Output for 8.1.21 First: 0.041707992553711
Second: 0.041783094406128
Output for 8.1.20 First: 0.044260025024414
Second: 0.041673898696899
Output for 8.1.19 First: 0.041400909423828
Second: 0.041521072387695
Output for 8.1.18 First: 0.040438890457153
Second: 0.041352033615112
Output for 8.1.17 First: 0.041359186172485
Second: 0.041740894317627
Output for 8.1.16 First: 0.040848016738892
Second: 0.041817903518677
Output for 8.1.15 First: 0.04172682762146
Second: 0.043807983398438
Output for 8.1.14 First: 0.041518926620483
Second: 0.041341066360474
Output for 8.1.13 First: 0.039282083511353
Second: 0.041761875152588
Output for 8.1.12 First: 0.039524078369141
Second: 0.041828870773315
Output for 8.1.11 First: 0.042301893234253
Second: 0.041584014892578
Output for 8.1.10 First: 0.039806842803955
Second: 0.041762113571167
Output for 8.1.9 First: 0.039847850799561
Second: 0.042057037353516
Output for 8.1.8 First: 0.039846181869507
Second: 0.041393995285034
Output for 8.1.7 First: 0.042652130126953
Second: 0.041875123977661
Output for 8.1.6 First: 0.054214000701904
Second: 0.070704936981201
Output for 8.1.5 First: 0.054033994674683
Second: 0.070642948150635
Output for 8.1.4 First: 0.05431604385376
Second: 0.070234060287476
Output for 8.1.3 First: 0.054160118103027
Second: 0.070533990859985
Output for 8.1.2 First: 0.053637027740479
Second: 0.070441007614136
Output for 8.1.1 First: 0.059493780136108
Second: 0.071264982223511
Output for 8.1.0 First: 0.066246032714844
Second: 0.076318025588989
Output for 8.0.30 First: 0.041524887084961
Second: 0.04524302482605
Output for 8.0.29 First: 0.043905019760132
Second: 0.046617031097412
Output for 8.0.28 First: 0.044249773025513
Second: 0.045265913009644
Output for 8.0.27 First: 0.0469970703125
Second: 0.048372983932495
Output for 8.0.26 First: 0.042693853378296
Second: 0.046902894973755
Output for 8.0.25 First: 0.050859928131104
Second: 0.058645963668823
Output for 8.0.24 First: 0.062791109085083
Second: 0.057275056838989
Output for 8.0.23 First: 0.043272018432617
Second: 0.045203924179077
Output for 8.0.22 First: 0.056487083435059
Second: 0.054663896560669
Output for 8.0.21 First: 0.043190002441406
Second: 0.045099973678589
Output for 8.0.20 First: 0.042367935180664
Second: 0.045168161392212
Output for 8.0.19 First: 0.055480003356934
Second: 0.067873001098633
Output for 8.0.18 First: 0.059278011322021
Second: 0.073122978210449
Output for 8.0.17 First: 0.05456805229187
Second: 0.067469120025635
Output for 8.0.16 First: 0.057533025741577
Second: 0.068212985992432
Output for 8.0.15 First: 0.057476997375488
Second: 0.067552089691162
Output for 8.0.14 First: 0.055113077163696
Second: 0.068035125732422
Output for 8.0.13 First: 0.055701017379761
Second: 0.067930936813354
Output for 8.0.12 First: 0.060717821121216
Second: 0.067602872848511
Output for 8.0.11 First: 0.054713010787964
Second: 0.068058967590332
Output for 8.0.10 First: 0.055809020996094
Second: 0.067785978317261
Output for 8.0.9 First: 0.057864904403687
Second: 0.069579839706421
Output for 8.0.8 First: 0.081801891326904
Second: 0.073732852935791
Output for 8.0.7 First: 0.055749893188477
Second: 0.067960977554321
Output for 8.0.6 First: 0.054164171218872
Second: 0.068023204803467
Output for 8.0.5 First: 0.054444074630737
Second: 0.067935943603516
Output for 8.0.3 First: 0.064883947372437
Second: 0.05620813369751
Output for 8.0.2 First: 0.089169025421143
Second: 0.086715936660767
Output for 8.0.1 First: 0.055608034133911
Second: 0.067877054214478
Output for 8.0.0 First: 0.080181837081909
Second: 0.097776174545288
Output for 7.4.33 First: 0.045032978057861
Second: 0.051236152648926
Output for 7.4.32 First: 0.043293952941895
Second: 0.050166130065918
Output for 7.4.30 First: 0.043449878692627
Second: 0.050476789474487
Output for 7.4.29 First: 0.059272050857544
Second: 0.076767921447754
Output for 7.4.28 First: 0.059267044067383
Second: 0.076886892318726
Output for 7.4.27 First: 0.060788869857788
Second: 0.080291032791138
Output for 7.4.26 First: 0.070405006408691
Second: 0.10839104652405
Output for 7.4.25 First: 0.060436010360718
Second: 0.07831597328186
Output for 7.4.24 First: 0.059470176696777
Second: 0.079339027404785
Output for 7.4.23 First: 0.060271024703979
Second: 0.078624963760376
Output for 7.4.22 First: 0.098555088043213
Second: 0.12598514556885
Output for 7.4.21 First: 0.070679903030396
Second: 0.086859941482544
Output for 7.4.20 First: 0.059384107589722
Second: 0.077291011810303
Output for 7.4.16 First: 0.069961071014404
Second: 0.08919620513916
Output for 7.4.15 First: 0.091124057769775
Second: 0.12868809700012
Output for 7.4.14 First: 0.072015047073364
Second: 0.09503698348999
Output for 7.4.13 First: 0.093354940414429
Second: 0.097944021224976
Output for 7.4.12 First: 0.11051893234253
Second: 0.14392614364624
Output for 7.4.11 First: 0.07278299331665
Second: 0.089431047439575
Output for 7.4.10 First: 0.084594011306763
Second: 0.10099697113037
Output for 7.4.9 First: 0.090507030487061
Second: 0.10353398323059
Output for 7.4.8 First: 0.076241970062256
Second: 0.096185922622681
Output for 7.4.7 First: 0.070260047912598
Second: 0.088460922241211
Output for 7.4.6 First: 0.11539506912231
Second: 0.10180902481079
Output for 7.4.5 First: 0.059855937957764
Second: 0.074297189712524
Output for 7.4.4 First: 0.12536692619324
Second: 0.13683295249939
Output for 7.4.3 First: 0.12779211997986
Second: 0.14310908317566
Output for 7.4.0 First: 0.099562168121338
Second: 0.10877895355225
Output for 7.3.33 First: 0.062674999237061
Second: 0.084808826446533
Output for 7.3.32 First: 0.062134027481079
Second: 0.08472204208374
Output for 7.3.31 First: 0.062213182449341
Second: 0.084235906600952
Output for 7.3.30 First: 0.063066005706787
Second: 0.084702968597412
Output for 7.3.29 First: 0.12853002548218
Second: 0.10278701782227
Output for 7.3.28 First: 0.080665111541748
Second: 0.099753856658936
Output for 7.3.27 First: 0.10278105735779
Second: 0.12183213233948
Output for 7.3.26 First: 0.0917809009552
Second: 0.098402976989746
Output for 7.3.25 First: 0.13218593597412
Second: 0.10495781898499
Output for 7.3.24 First: 0.13445210456848
Second: 0.14183902740479
Output for 7.3.23 First: 0.092390060424805
Second: 0.1224799156189
Output for 7.3.21 First: 0.091449975967407
Second: 0.11079287528992
Output for 7.3.20 First: 0.12199807167053
Second: 0.11593103408813
Output for 7.3.19 First: 0.094064950942993
Second: 0.12826991081238
Output for 7.3.18 First: 0.085851907730103
Second: 0.096948146820068
Output for 7.3.17 First: 0.12777495384216
Second: 0.13555097579956
Output for 7.3.16 First: 0.084136009216309
Second: 0.094902038574219
Output for 7.3.12 First: 0.099629878997803
Second: 0.097529888153076
Output for 7.3.11 First: 0.10300898551941
Second: 0.098140954971313
Output for 7.3.10 First: 0.063696146011353
Second: 0.077413082122803
Output for 7.3.9 First: 0.077762842178345
Second: 0.076639890670776
Output for 7.3.8 First: 0.068681001663208
Second: 0.083314895629883
Output for 7.3.7 First: 0.062109231948853
Second: 0.074485063552856
Output for 7.3.6 First: 0.062088966369629
Second: 0.082496881484985
Output for 7.3.5 First: 0.065244913101196
Second: 0.077049016952515
Output for 7.3.4 First: 0.062126874923706
Second: 0.0747389793396
Output for 7.3.3 First: 0.06452202796936
Second: 0.07466197013855
Output for 7.3.2 First: 0.062061071395874
Second: 0.074338912963867
Output for 7.3.1 First: 0.061278104782104
Second: 0.074501037597656
Output for 7.3.0 First: 0.070012092590332
Second: 0.079957008361816
Output for 7.2.33 First: 0.13030409812927
Second: 0.13450694084167
Output for 7.2.32 First: 0.082630157470703
Second: 0.099350929260254
Output for 7.2.31 First: 0.088219165802002
Second: 0.10676908493042
Output for 7.2.30 First: 0.096159934997559
Second: 0.11293983459473
Output for 7.2.29 First: 0.080566883087158
Second: 0.097032070159912
Output for 7.2.25 First: 0.10138320922852
Second: 0.086118936538696
Output for 7.2.24 First: 0.073938846588135
Second: 0.084378004074097
Output for 7.2.23 First: 0.105623960495
Second: 0.087831020355225
Output for 7.2.22 First: 0.068602085113525
Second: 0.078222036361694
Output for 7.2.21 First: 0.06359601020813
Second: 0.075863122940063
Output for 7.2.20 First: 0.061293125152588
Second: 0.07825493812561
Output for 7.2.19 First: 0.063502073287964
Second: 0.075445890426636
Output for 7.2.18 First: 0.060669898986816
Second: 0.075620174407959
Output for 7.2.17 First: 0.099694013595581
Second: 0.080770015716553
Output for 7.2.6 First: 0.05217719078064
Second: 0.05771803855896
Output for 7.2.0 First: 0.068236827850342
Second: 0.068158149719238
Output for 7.1.33 First: 0.067455053329468
Second: 0.17805600166321
Output for 7.1.32 First: 0.075236797332764
Second: 0.1859929561615
Output for 7.1.31 First: 0.070016860961914
Second: 0.16698598861694
Output for 7.1.30 First: 0.07794189453125
Second: 0.18216705322266
Output for 7.1.29 First: 0.065025091171265
Second: 0.18755102157593
Output for 7.1.28 First: 0.10655808448792
Second: 0.19127011299133
Output for 7.1.27 First: 0.067821979522705
Second: 0.16054511070251
Output for 7.1.26 First: 0.064537048339844
Second: 0.15956807136536
Output for 7.1.20 First: 0.056998014450073
Second: 0.063111066818237
Output for 7.1.10 First: 0.061882019042969
Second: 0.073585987091064
Output for 7.1.7 First: 0.059312105178833
Second: 0.066092014312744
Output for 7.1.6 First: 0.095571041107178
Second: 0.08469295501709
Output for 7.1.5 First: 0.063350915908813
Second: 0.072870969772339
Output for 7.1.0 First: 0.078792095184326
Second: 0.076618909835815
Output for 7.0.20 First: 0.05935001373291
Second: 0.062040090560913
Output for 7.0.10 First: 0.10571718215942
Second: 0.093211889266968
Output for 7.0.9 First: 0.070158958435059
Second: 0.07387900352478
Output for 7.0.8 First: 0.057173013687134
Second: 0.07091498374939
Output for 7.0.7 First: 0.059302091598511
Second: 0.06821084022522
Output for 7.0.6 First: 0.0691819190979
Second: 0.072582960128784
Output for 7.0.5 First: 0.06860089302063
Second: 0.076956987380981
Output for 7.0.4 First: 0.055762052536011
Second: 0.069659948348999
Output for 7.0.3 First: 0.04947304725647
Second: 0.065530061721802
Output for 7.0.2 First: 0.053617000579834
Second: 0.069031000137329
Output for 7.0.1 First: 0.068604946136475
Second: 0.071491003036499
Output for 7.0.0 First: 0.062762975692749
Second: 0.070092916488647
Output for 5.6.0 - 5.6.28 Parse error: syntax error, unexpected '(' in /in/e0qoK on line 12
Process exited with code 255 . Output for 5.5.0 - 5.5.38 Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/e0qoK on line 10
Process exited with code 255 . preferences:dark mode live preview
229.06 ms | 401 KiB | 255 Q