Slow parser in PHP

Asked

Viewed 91 times

0

I’m making a parser complete of a website, to change all the hrefs and src, is part of a system that I am developing, today I went to the home of a friend who has the internet of 1Mega only, here where I live the speed of the internet is something critical, and the system will run more around here, so I worried because it took a long time to open the site with the parser, used many str_replace, tried to use the DOM but I don’t think it would be viable for an entire website.

The Server that the script is running is a simple dedicated, it has the ping a little high for being abroad and using https, would the server have something to do with the slowness? Someone would advise me to use another method to replace the site links?

  • 7

    The speed of the internet will not affect the processing at all. The only thing it would affect is if you are moving data unnecessarily.

  • But here at home my connection is 3 megas, and the ping is smaller, and opens almost 5 times faster.

  • 2

    I believe there are two possible causes: 1) Very heavy content for 1MB internet; 2) Your methods are causing slowness in the process.

  • What I used most was str_replace, tried the DOM, but it was many different links and ended up getting heavier with the DOM.

  • 2

    Do parser naturally it is slow, but you have to identify the cause first! It is no use to think that the fault is the str_replace and upload 10MB images... Do a debug, and see in the browser console what is loading.

  • 1

    I’ll do it @Papacharlie

  • 2

    So the problem is the volume of data, if you are sending unnecessary data, stop doing this. This has nothing to do with processing. If you are sending only the necessary, there is nothing you can do to resolve this problem. If the problem is parsing the speed of the connection will not affect anything. Make it faster just make it wait longer than it already is.

  • 2

    It’s hard to answer without seeing what you’re doing.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.