Perfomance Issue

Hi beavers!
I like this awesome plugin!

We developéd about 10 custom modules with big configuration forms (form_fields with a lot of option lists). For each option list, we have to query an external database (perhaps 0.1 seconds per request).

10 modules x 3 options lists * 0.1 seconds = 3 seconds on each page load (!)

Our problem: beaverBuilder loads on init all forms from all modules - so the page speed is slowing down… (even builderbuilder is not used).

Is there a way to load forms for custom modules only if they needed?

Our custom module init:

function tt_load_modules(){
    if (class_exists('FLBuilder')) {
        // 10 modules loaded here per require_once
    }
}
add_action('init', 'tt_load_modules');

Hey Sebastian,

I’ve already assigned another member of the team to assist you with your inquiry. :slight_smile:

Ben

Hey Sebastian,

I haven’t tested this, but I believe you could load the modules conditionally based on if the builder is enabled for a page or if the interface is active. That would be done like so…

if ( class_exists(‘FLBuilder’) && ( FLBuilderModel::is_builder_active() || FLBuilderModel::is_builder_enabled() ) ) {
// Load your modules.
}

Give that a shot and let me know how it goes.

Justin

Hi Justin,
thanks for reply! Your example disables the whole custom modules in the frontend - but you show me the right way, this is my solution:

  public static function my_option_list()
    {

        // leave the function, if bbuilder is not active...
        if(FLBuilderModel::is_builder_enabled() === false){
            return;
        }

       // my heavy code ....
}

Merci!

Hey Sebastian,

Glad to see you got it figured out. Thanks for posting the solution!

Justin