Performance killer : t-function called in global scope

quaoar - December 3, 2008 - 11:58
Project:UC Discounts
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

On line 14 and 15 in the uc_discounts.module, we find these two lines:
define('UC_DISCOUNTS_YES', t('yes'));
define('UC_DISCOUNTS_NO', t('no'));

This is really bad for performance.
Calling t() in globale scope forces a call to locale_refresh_cache for every page view.
We have just changed it to this for now:
define('UC_DISCOUNTS_YES', 'yes');
define('UC_DISCOUNTS_NO', 'no');

#1

dereine - January 22, 2009 - 12:55

this is something very bad, plese fix it

AttachmentSize
bad_performance.patch 2.33 KB

#2

dereine - January 22, 2009 - 12:55
Status:active» needs review
 
 

Drupal is a registered trademark of Dries Buytaert.