Skip to content

Commit

Permalink
pts-core: Possible pts_test_profile_parser optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellarabel committed Aug 31, 2015
1 parent 05ebc7d commit 923bc85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pts-core/commands/debug_render_test.php
Expand Up @@ -85,15 +85,15 @@ public static function run($r)
if(stripos($result_object->get_arguments_description(), 'frame time') !== false)
continue;

echo $result_object->test_profile->get_title() . PHP_EOL;
echo $result_object->test_profile->get_title() . ' ';
//echo '<h3>' . $result_object->get_arguments_description() . '</h3>';
pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
unset($result_object);
}

$table = new pts_ResultFileSystemsTable($result_file);
pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes);
echo 'RENDER TEST ON: ' . $REQUESTED . ' TOOK ' . (time() - $this_render_test) . PHP_EOL;
echo PHP_EOL . PHP_EOL . 'RENDER TEST ON: ' . $REQUESTED . ' TOOK ' . (time() - $this_render_test) . PHP_EOL;
}
echo PHP_EOL . 'RENDER TEST TOOK: ' . (time() - $start) . PHP_EOL . PHP_EOL;
}
Expand Down
13 changes: 9 additions & 4 deletions pts-core/objects/pts_test_profile_parser.php
Expand Up @@ -41,7 +41,7 @@ public function __construct($read = null, $normal_init = true)
return;
}

if(strpos($read, '<?xml version="1.0"?>') === false)
if(!isset($read[200]) && strpos($read, '<?xml version="1.0"?>') === false)
{
if(PTS_IS_CLIENT && (!defined('PTS_TEST_PROFILE_PATH') || !is_file(PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml')))
{
Expand Down Expand Up @@ -80,17 +80,22 @@ public function __construct($read = null, $normal_init = true)
}
}

//$xml_options = 0;
//if(defined('LIBXML_COMPACT'))
//{
$xml_options = LIBXML_COMPACT;
//}

if(is_file($read))
{
$this->file_location = $read;
$read = file_get_contents($read);
$this->xml = simplexml_load_file($read, 'SimpleXMLElement', $xml_options);
}
else
{
$this->raw_xml = $read;
$this->xml = simplexml_load_string($read, 'SimpleXMLElement', $xml_options);
}

$this->xml = simplexml_load_string($read);
}
public function get_raw_xml()
{
Expand Down

0 comments on commit 923bc85

Please sign in to comment.