WordPress.org

Ready to get started?Download WordPress

Forums

Are templates and plugins re-read for each visitor? (3 posts)

  1. garbonzo
    Member
    Posted 6 years ago #

    When someone visits my site, does that force the server to read all my site's files - templates, plugins, wordpress, etc., before serving the page?

    When someone does something that triggers a function written into a plugin , does my server have to re-read the plugin's code before executing it?

    Or is all the code cached somewhere, and only re-read if it knows that there's been changes?

    Because I'm writing a plugin that is quite lengthy. I could split it up into several small files, or leave it as one giant file.

    I could use smaller files to separate out the functions, so that the server wouldn't have to read a massive page just to find and execute one little function. But if all pages are re-read each time someone visits the site, then I might as well have all the plugin's code on one single page.

    Did that make sense?
    Thanks for your responses

  2. NC@WP
    Member
    Posted 6 years ago #

    When someone visits my site, does that force the server to read all my site's files - templates, plugins, wordpress, etc., before serving the page?

    That would depend on the server's caching mechanism, as well as on whether WordPress is running with a caching plugin.

    When someone does something that triggers a function written into a plugin , does my server have to re-read the plugin's code before executing it?

    Generally, no, unless the code file has been changed recently. Most hosting companies use a technique called "opcode caching".

    I'm writing a plugin that is quite lengthy. I could split it up into several small files, or leave it as one giant file.

    It's not going to matter much. In and of itself, PHP is very fast. Most of the time spent by PHP scripts is spent waiting to establish a connection to a database server and then waiting for it to return results of a query.

  3. garbonzo
    Member
    Posted 6 years ago #

    Thanks NC

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.