This topic has 4 replies, 2 voices, and was last updated 9 years by Abe.

  • Author

    Tagged: 

  • #62326
     marius_g
    Participant

    During a page load kleo_icons_array() is called many many times.

    Every time it is called it loads a large JSON from the file system and parses it with json_decode. It should be cached, only loaded once.

    COPY CODE
    
    	function kleo_icons_array() {
    
    		$icons= array('');
    
    		$icons_json = file_get_contents( KLEO_LIB_DIR . '/assets/font-icons.json');
    		if ($icons_json) {
    			$arr = json_decode($icons_json, true);
    			foreach($arr['glyphs'] as $icon) 
    			{
    				$icons[$icon['css']] = $icon['css'];
    				asort($icons);
    			}
    		}
    
    		return $icons;
    	}
    

    The calls to kleo_icons_array() consumes 13% of the time it takes to produce the html page(!). According to New Relic APM trace attached.

    So optimizing this function could be the best performance enhancement ever 🙂

    Please prioritize this!

    Thanks!
    Marius

    Attachments:
    You must be logged in to view attached files.
    #62410
     Abe
    Keymaster

    hi, I will definitely take a look and let you know the solution. Thank you

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #62545
     Abe
    Keymaster

    We are releasing an update now with an improvement on this matter also. we added a transient for it so it is calculated just once.

    Thank you for letting us know

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #63133
     marius_g
    Participant

    Deployed the latest version and immediately saw a 200ms improvement in serving the html page. Nice!

    Attachments:
    You must be logged in to view attached files.
    #63137
     Abe
    Keymaster

    Awesome. Glad to hear that.

    Thanks

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?