Support » Plugin: List category posts » Plugin times out – suggested fix

  • I noticed that this plugin was running very slow after I made some changes to my server setup, and then over the weekend it started timing out and throwing the PHP error

    Maximum exection time of 30 seconds exceeded in /PATH/lcp-catlist.php on line342.

    This line contains a preg_replace() call, and my understanding is that this function is quite expensive.

    I’m not sure what this line does, but when I removed the entire containing IF statement, the plugin now FLIES and I can’t see any real difference with the output in my particular configuration.

    Is the preg_replace() necessary, or might it be possible to achieve the same outcome with a less expensive function?

    Thanks for a great plugin that I use extensively!

    • This topic was modified 2 years, 11 months ago by tirussell.
    • This topic was modified 2 years, 11 months ago by tirussell.
    • This topic was modified 2 years, 11 months ago by tirussell.
Viewing 1 replies (of 1 total)
  • Plugin Author Fernando Briano

    (@fernandobt)

    Hi @tirussell, that’s a great find. I do think we can probably improve this by using strpos with a single string instead of preg_match. I wonder why we were using a regular expression there though. My understanding is “more” just adds <!--more--> to the post so we could just see if that string is present instead of checking with a regular expression.

    We can also probably get the content without checking for that “more” link. I’ll dig into this, but it sounds like it’s definitely a performance improvement if we get rid of that regular expression.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin times out – suggested fix’ is closed to new replies.