-
Notifications
You must be signed in to change notification settings - Fork 2
/
maptest2.php
35 lines (26 loc) · 1.06 KB
/
maptest2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$script_start_time=microtime(true);
define ('INCLUDE_DIR','include/');
require_once INCLUDE_DIR.'errorlog.php';
#Prep the game objects.
require_once INCLUDE_DIR.'paths.php';
require_once INCLUDE_DIR.'constants.php';
//require_once INCLUDE_DIR.'mysql.php';
//require_once INCLUDE_DIR.'map.php';
//Map parameters.
require_once 'maptest.inc.php';
$file_start_time=microtime(true);
$map=unserialize(@file_get_contents(MAPS_DIR."$mapid.map"));
$retval=array();
for($ypos=0;$ypos<$GLOBALS['minimap_height'];$ypos++)
for($xpos=0;$xpos<$GLOBALS['minimap_width'];$xpos++)
$retval[$ypos][$xpos]=ord($map['map'][($yloc+$ypos)*$map['width']+($xloc+$xpos)]);
$file_end_time=microtime(true);
$script_diff=$file_end_time-$script_start_time;
$access_diff=$file_end_time-$file_start_time;
$overhead=$script_diff-$access_diff;
echo "Test 2: Load and unserialize whole file, parse partial structure.<br>";
echo "Script:$file_end_time-$script_start_time=".($script_diff)."<br>";
echo "Access:$file_end_time-$file_start_time=".($access_diff)."<br>";
echo "Overhead: $overhead";
?>