Advertisement:

Author Topic: Osclass code optimization .  (Read 119 times)

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Osclass code optimization .
« 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 ?
« Last Edit: June 11, 2019, 01:17:29 pm by Web-Media »