Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Test file for case >>for_precalc<< [test ID: num_array_read-for_vs_foreach]
- //Generated at Mon, 07 Jul 2014 23:09:13 +0200
- /*************** ./c4_env.inc.php START ***************/
- gc_disable();
- $_c4Results = array();
- function _startC4Timer() { $GLOBALS["_c4ts"] = microtime(true); }
- function _stopC4Timer() { return microtime(true)-$GLOBALS["_c4ts"]; }
- function _startC4Mem() {}
- function _stopC4Mem() { return -1; } //TODO: memory functions
- function startC4() {
- _stopC4Mem();
- _startC4Timer();
- }
- function stopC4() {
- echo die(json_encode(array("time" => _stopC4Timer(), "mem" => _stopC4Mem())));
- }
- /*************** ./c4_env.inc.php END ***************/
- /*************** ./tests/num_array_read-for_vs_foreach/__init.inc.php START ***************/
- $smallArray = range(0,3);
- $mediumArray = range(0,100);
- $bigArray = range(0,1000);
- $hugeArray = range(0,10000);
- /*************** ./tests/num_array_read-for_vs_foreach/__init.inc.php END ***************/
- /*** Test case with 1000 iteration(s) ***/
- startC4();
- for($i=0; $i<1000; $i++) {
- /*************** ./tests/num_array_read-for_vs_foreach/for_precalc.c4.php START ***************/
- $size = count($smallArray);
- for($i=0; $i<$size; $i++) $tmp = $smallArray[$i];
- $size = count($mediumArray);
- for($i=0; $i<$size; $i++) $tmp = $mediumArray[$i];
- $size = count($bigArray);
- for($i=0; $i<$size; $i++) $tmp = $bigArray[$i];
- $size = count($hugeArray);
- for($i=0; $i<$size; $i++) $tmp = $hugeArray[$i];
- /*************** ./tests/num_array_read-for_vs_foreach/for_precalc.c4.php END ***************/
- }
- stopC4();
- //END OF CASE FILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement