Answer the question
In order to leave comments, you need to log in
Can PHP Simple HTML DOM Parser slow down like this?
Banal getting a DOM tree takes 6-8 seconds, not to mention some other manipulations.
<?php
$start = microtime(true);
include('simple_html_dom.php');
$url = 'forum.html'; // вроде бы и файл не большой, всего 386 Кб
$html = file_get_html($url);
echo '<p>Время выполнения скрипта: '.round(microtime(true) - $start, 4).' сек.</p>';
?>
Время выполнения скрипта: 6.7568 сек.
Answer the question
In order to leave comments, you need to log in
This is the norm, the tool itself is very gluttonous in terms of resources.
the more HTML, the longer the script runs and eats more operatives.
I urge you to burn this parser's house on a ritual fire and use Naokogiri (I did it at one time)
on Denver, the test also didn’t like the parsing execution time, but it’s acceptable, when transferring to a hosting, the speed increased several times.
you check this way, maybe getting html itself takes a lot of time
$start = microtime(true);
file_get_content('forum.html');
echo '<p>Время выполнения скрипта: '.round(microtime(true) - $start, 4).' сек.</p>';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question