CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • localisation makes civicrm slow
Pages: 1 [2]

Author Topic: localisation makes civicrm slow  (Read 2604 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: localisation makes civicrm slow
November 22, 2011, 06:03:00 am
Hi,

Tried to see where the language is set (to try to disable it, see if it has any impact on the perf).... and got lost.

Could one provide pointers?

Otherwise,

Quote
Hitting the ajax contact_get url causes crm_translate to be called 398 times.
Most of them seem to be as part of getfields which in turn calls $BAO::fields which turns out to be a fairly slow function as it calls 'ts' many times

What is translated in the fields? Is this only when that's a multi-lingual install? Anyway, The field labels aren't used by the API, right?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: localisation makes civicrm slow
November 22, 2011, 06:27:14 am

$config->lcMessages

stored in the config object and initialized when config is loaded

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: localisation makes civicrm slow
November 22, 2011, 01:03:55 pm
Xavier - to the extent the issue is through the API then finding a way to cache getfields results (on a per entity_action basis) would help a lot. We'd need to make it possible to purge the cache & maybe we'd need to purge it in some API calls - e.g. if you create a new custom field then the cache should probably be purged as it may have changed.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: localisation makes civicrm slow
November 22, 2011, 01:17:19 pm
Before caching, I would like to understand why getfields need to be called and generates 400 crm_translates.

(ie. I don't see why it needs to be called, nor why is this called so many times, I'd rather fix that that "hiding" the issue downstream)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: localisation makes civicrm slow
November 22, 2011, 01:51:46 pm
It's used in the wrapper for date handling, default setting, verify mandatory. Actually it's used more in 4.1 & the test was done on 3.4 I think. Probably good for you to look through that code anyway as I'm sure you will have some ideas on how to improve it.

Still not sure it accounts for all of those calls but it will add some. Caching in the DAO->fields() functions themselves wouldn't need any purging.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: localisation makes civicrm slow
November 22, 2011, 02:11:51 pm
But get fields are/shouldn't be more than getting the list of attributes of the class. ie. should be "free" in the first place, no need to cache, that should be close to the metal anyway.

Am I missing something?

May be we need a getFieldsRaw (ie for date handling, default setting, verify mandatory, we don't need any translation). Will investigate as soon as I can get something out of xdebug profiling (so far, I fail)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: localisation makes civicrm slow
November 22, 2011, 02:42:38 pm
The ts() function calls are in the $dao->fields() functions
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • localisation makes civicrm slow

This forum was archived on 2017-11-26.