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.

Possible optimizations in send_emails?

  1. sboisvert@bryxal.ca
    Member

    It seems that the database is being queried for every variable when using '{all_fields}' in an email notification. I didn't think much of it until I saw how much slower that page was than others and getting the time profile graph it seemed that it could definitely be optimized. it seems to take about 80ms per call thru this path:

    GFCommon::get_submitted_fields
    GFormsModel::get_lead_field_value
    RGFormsModel::get_field_value_long
    wpdb::get_var
    W3_Db::query
    wpdb::query

    And it is being done 17 times during the course of sending 2 emails of a form that has 6 fields.
    It might be worth looking into caching the results of the query the first time around in a global variable and re-using that? (or some other way to optimize this, I'm not 100% sure of what exactly the code does, just that it ads 1s that I believe might be able to be shaved off)

    Hope this can be of use!

    -Steph

    Posted 12 years ago on Thursday March 15, 2012 | Permalink