D
D
D3N1K2014-07-24 16:08:53
PHP
D3N1K, 2014-07-24 16:08:53

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>';
?>

Returns:
Время выполнения скрипта: 6.7568 сек.
Tell me, is this clearly the reason in this library? Or is 6-8 seconds normal? It seems that this script takes 0-2 seconds for people.
I use:
Open Server 5.1.1
PHP 5.3
PHP Simple HTML DOM 1.5

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander N++, 2014-07-24
@D3N1K

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.

S
sasha, 2014-07-24
@madmages

I urge you to burn this parser's house on a ritual fire and use Naokogiri (I did it at one time)

F
freddy, 2014-07-24
@mfred

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.

S
Sergey Melnikov, 2014-07-24
@mlnkv

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 question

Ask a Question

731 491 924 answers to any question