PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Speed improvement in gform_tooltip() when using WPML (or other)

  1. sboisvert@bryxal.ca
    Member

    Good day,

    When using a translation plugin such as WPML there can be quite some overhead on gform_tooltip. See https://trello-attachments.s3.amazonaws.com/4f215e75640b8380712c04c9/515b56167b831c1549002966/bfb31dbebfe357cd95bac62989435044/upload_2013-06-19_at_12.15.32_pm.png

    Since the function calls an array of strings which all the translations are fetched every function call.

    If the variable $gf_tooltips is declared outside the scope of the function as a global variable and then referenced inside the function the translations are only fetched once.

    Here is a link to an SVN patch against version 1.7.5
    https://trello-attachments.s3.amazonaws.com/4f215e75640b8380712c04c9/515b56167b831c1549002966/68ca5ae9c21f5b91b2e5c6c1b01aadd1/tooltips.php.patch

    I'm sure there are also other ways this could be made more efficient by making this into a singleton or such, but this seemed like the simplest way to accomplish the biggest speed improvement.

    Thank you,

    Posted 10 years ago on Wednesday June 19, 2013 | Permalink
  2. David Peralty

    I'll pass this on to our developers. Thank you very much.

    Posted 10 years ago on Thursday June 20, 2013 | Permalink
  3. Thanks for the troubleshooting and recommendation. I will be looking at getting that implemented.
    Cheers.

    Posted 10 years ago on Friday June 21, 2013 | Permalink

This topic has been resolved and has been closed to new replies.