- Joined
- Apr 9, 2008
- Messages
- 1,416
- Reaction score
- 169
it may come as a shock that i decided to come back but i never felt satisfied with how it ended. i wanted to do something to my abilities and finish it right...
so now onto this thread:
i wanted to see the fastest way to load the coords is now with all files output the same information.
RESULTS:
heres the code so you can try it yourself if you want to test the results
so heres what i have now *characters donated graciously by @Rampenbram
as you can see there isnt a lot showing. it has to do with how to order the layers and i can only do so much with the little amount donated to me.
im basically at the point i need more characters to do the fine details. i have 2 options either host my own server and build the character table myself *might take forever* or request assistance from another server that already has the character table established.
if you want to help test this code further please dont hesitate to email me.
so now onto this thread:
i wanted to see the fastest way to load the coords is now with all files output the same information.
RESULTS:
Code:
Loading 1 json file and parsing it 50 times took: 0.013000965118408
Loading 1 ini file and parsing it 50 times took: 0.0060000419616699
Loading 1 ini file and parsing with processing sections (ON) it 50 times took: 0.0060000419616699
Loading 1 xml file and parsing it 50 times took: 0.019001007080078
test.php
test.json
test.ini
test.xml
Code:
<?php
set_time_limit(120);
class timer {
private $start;
private $end;
public function timer() {
$this->start = microtime(true);
}
public function Finish() {
$this->end = microtime(true);
}
private function GetStart() {
if (isset($this->start))
return $this->start;
else
return false;
}
private function GetEnd() {
if (isset($this->end))
return $this->end;
else
return false;
}
public function GetDiff() {
return $this->GetEnd() - $this->GetStart();
}
public function Reset() {
$this->start = microtime(true);
}
}
$times = 50;
echo "Loading 1 json file and parsing it ".$times." times took: ";
$timer = new timer();
for($i=0; $i<$times; $i++) {
$json = json_decode(file_get_contents("./test.json"));
}
$timer->Finish();
echo $timer->getDiff()."<br />";
echo "Loading 1 ini file and parsing it ".$times." times took: ";
$timer->Reset();
for($i=0; $i<$times; $i++) {
$ini = parse_ini_file("./test.ini");
}
$timer->Finish();
echo $timer->getDiff()."<br />";
echo "Loading 1 ini file and parsing with processing sections (ON) it ".$times." times took: ";
$timer->Reset();
for($i=0; $i<$times; $i++) {
$ini = parse_ini_file("./test.ini", true);
}
$timer->Finish();
echo $timer->getDiff()."<br />";
echo "Loading 1 xml file and parsing it ".$times." times took: ";
$timer->Reset();
for($i=0; $i<$times; $i++) {
$xml = simplexml_load_file("./test.xml");
}
$timer->Finish();
echo $timer->getDiff()."<br />";
?>
Code:
[{"ID":"20000","x":-12,"y":4,"z":"face"}]
Code:
[0]
ID=20000
x=-12
y=4
z=face
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<imgdir>
<_0>
<ID>20000</ID>
<x>-12</x>
<y>4</y>
<z>face</z>
</_0>
</imgdir>
so heres what i have now *characters donated graciously by @Rampenbram
as you can see there isnt a lot showing. it has to do with how to order the layers and i can only do so much with the little amount donated to me.
im basically at the point i need more characters to do the fine details. i have 2 options either host my own server and build the character table myself *might take forever* or request assistance from another server that already has the character table established.
if you want to help test this code further please dont hesitate to email me.
Attachments
You must be registered for see attachments list