• Resolved maksimwp1

    (@maksimwp1)


    Hello!
    I made a calculator of trigonometric functions, but it takes a long time, especially from the mobile version.
    Tell me how you can speed up such a calculator, which has a lot of calculations?
    thanks

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @maksimwp1

    I’ll try to describe first how the plugin works to allows you understand the cause of the issue. By pressing the calculate button, the plugin evaluate all the equations. However, if the value of a field varies as a result of the equation, the plugin should evaluate all the equations that are affected by this field. The plugin repeats the process until no field varies its value. Please, take care to not generate an infinite loop.

    I’ve checked your form, and the equations should be optimized. I’ll try to illustrate the process with a specific equation. The equation associated with the fieldname147 field is:

    
    (function(){
    if(fieldname144 == 3) return prec(TAN(fieldname140),3);
    if(fieldname144 == 4) return prec(TAN(fieldname140),4);
    if(fieldname144 == 5) return prec(TAN(fieldname140),5);
    if(fieldname144 == 6) return prec(TAN(fieldname140),6);
    if(fieldname144 == 7) return prec(TAN(fieldname140),7);
    if(fieldname144 == 8) return prec(TAN(fieldname140),8);
    if(fieldname144 == 9) return prec(TAN(fieldname140),9);
    if(fieldname144 == 10) return prec(TAN(fieldname140),10);
    if(fieldname144 == 11) return prec(TAN(fieldname140),11);
    if(fieldname144 == 12) return prec(TAN(fieldname140),12);
    if(fieldname144 == 13) return prec(TAN(fieldname140),13);
    if(fieldname144 == 14) return prec(TAN(fieldname140),14);
    if(fieldname144 == 15) return prec(TAN(fieldname140),15);
    if(fieldname144 == 16) return prec(TAN(fieldname140),16);
    if(fieldname144 == 17) return prec(TAN(fieldname140),17);
    if(fieldname144 == 18) return prec(TAN(fieldname140),18);
    if(fieldname144 == 19) return prec(TAN(fieldname140),19);
    })();
    

    However, the correct implementation would be simply:

    
    prec(TAN(fieldname140),fieldname144)
    

    Please, check your other equations.

    Best regards.

    Thread Starter maksimwp1

    (@maksimwp1)

    Thanks for the quick reply.

    1) But something is all the same when checking the page load speed with google.com/speed/pagespeed
    the score is 30-40 points if you add a form…

    2) Also, when you press the “calculate” button, does the calculator take a long time to think, or is this normal?
    And the button even affects hidden fields, i.e. if I calculated in degrees, then the calculator also calculated in all other units of measurement … Is it possible to bind a button to the “Fieldset” field?

    Sorry if it’s not clear, I use a translator

    • This reply was modified 4 years, 4 months ago by maksimwp1.
    • This reply was modified 4 years, 4 months ago by maksimwp1.
    Plugin Author codepeople

    (@codepeople)

    Hello @maksimwp1

    First, when you press the calculate button all the equations are evaluated, even if they are associated with hidden calculated fields or not. The dependencies only affect to the submission process.

    I’ve checked your page’s performance and it is fine, please, look at the screenshot below:

    Best regards.

    • This reply was modified 4 years, 4 months ago by codepeople.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trigonometric functions’ is closed to new replies.