Osclass forums

Development => Development => Topic started by: Web-Media on June 11, 2019, 12:57:03 pm

Title: Osclass code optimization .
Post by: Web-Media on June 11, 2019, 12:57:03 pm
Hy all !
Working on a "comunity" version of osclass  trying to get more speed  and less memory usage refactoring  osclass code .
Untill now i've got 30 % less memory usage and 30% more speed
Example refactored code
Code: [Select]
if( !isset(self::$_purifier) ) {
$_config = \HTMLPurifier_Config::createDefault();
$_config->set('HTML.Allowed', '');
$_config->set('Cache.SerializerPath', osc_uploads_path());
self::$_purifier = new HTMLPurifier($_config);
unset ( $_config); }

Original code same config rebuilded for every purified value even it's the same
Code: [Select]
}self::$_config = HTMLPurifier_Config::createDefault();
self::$_config->set('HTML.Allowed', '');
self::$_config->set('Cache.SerializerPath', osc_uploads_path());
if( !isset(self::$_purifier) ) {
self::$_purifier = new HTMLPurifier(self::$_config);
 }
What's your thoughts for faster osclass and less memory usage ?