• Resolved jan.mazanek

    (@janmazanek)


    Hello, I run a plugin performance test with https://www.ads-software.com/plugins/code-profiler/ (and also old https://www.ads-software.com/plugins/p3-profiler/ )

    In both cases your plugin Featured Images in RSS for Mailchimp & More consumed 3 – 5 % of time of page request. There are plugins that consume 10 -20x less time/resources.

    Is it possible, that you could optimize the code to be executed only in case when it is really used? In our case we use your code to link posts from one website to another one. This is run only on 1 page and the results should be cached for several hours… So I would appreciate some optimization that this code would not run on source server on every URL request, but only on */feed/ requests…

    Could you please optimize your plugin to improve a little response time of the server?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author 5 Star Plugins

    (@5starplugins)

    Hi @janmazanek we’ll take a closer look at this right away. For the RSS triggers, I want to confirm that we do use the is_feed() function to then add the image only when the current request is for the RSS feed itself, none of that code should be running on non-feed page requests. We also use appropriate actions and such as well. There is some code that runs on admin pages, but we also evaluate if the admin page is our own admin page before running it. There may be some licensing SDK code that handles licensing with the Premium version, and performs external requests, but it should not be running with the free version, and it should cache those requests so they are not running on every page request.

    Note that we have very large sites with page caching in place using our plugin and they experience no performance issues, so it may also be other plugins, plugin or theme conflicts, or the unique structure of your site causing the plugin to have some issues that affect performance.

    I will do more profiling and see if I can spot what code would be causing any time during a normal page request.

    Thread Starter jan.mazanek

    (@janmazanek)

    @5starplugins thank you for reply. I do not know how exactly your plugin works, but I can’t see any call to is_feed() in featured_images_in_rss.php.
    Maybe you could simply change line 21 from:
    if ( !function_exists( ‘fifrf_fs’ ) ) {
    to:
    if (is_feed() && !function_exists( ‘fifrf_fs’ ) ) {
    ?

    Or mayby you could move the code from this script to subfolder “includes” and create lightweight featured_images_in_rss.php with content:
    if (is_feed()) {
    include_once(‘includes/name-of-script-containing-the-main-code.php”);
    }

    Plugin Author 5 Star Plugins

    (@5starplugins)

    Hi @janmazanek I took a look and we actually use a filter on the_excerpt_rss instead of is_feed, so that code only runs when the native WP function is called to generate the feed:

    add_filter(
                'the_excerpt_rss',
                'firss_featured_images_in_rss',
                1000,
                1
            );

    and then that function only runs if there is a featured image set:

    if ( has_post_thumbnail( $post->ID ) ) { ... }

    The fifrf_fs() code needs to run on init because it handles licensing, and adding admin options pages etc, which are outside the scope of the rss generation process.

    Plugin Author 5 Star Plugins

    (@5starplugins)

    Hi @janmazanek I also did a test using the Code Profiler plugin that you mentioned, and our plugin used 0.013 seconds of execution time in repeated tests on a live site, very performant in repeated uses. I also tested the /feed/ URL and it uses 0.062 seconds of execution time.

    So I am not seeing any specific slowness attributed to the plugin itself, but there may be other plugins or theme options affecting the speed of the site, and the speed of plugin execution in general, including server load, etc.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Run code only if feed is generated?’ is closed to new replies.