WordPress.org

Ready to get started?Download WordPress

Forums

Tweet Blender
Tweet Blender Speed Issues and JSON (1 post)

  1. Ryan Miller
    Member
    Posted 2 years ago #

    Hello,

    I've enjoyed using Tweet Blender for a number of years and consider it a critical plugin for my sites functionality.

    I recently switched hosts to WPEngine.com where I was encountering some speed issues. After some extensive testing we found that the way Tweet Blender implements JSON encoding and decoding is the primary cause of slowness. Their engineers helped refine the script in lib/lib.php with a much better version which doesn't cause slowness.

    Here's the rewritten code starting at line 292.

    // use our own version of JSON decoding
    if ( ! class_exists('Services_JSON') ) {
    	class Services_JSON {
    		public function encode($obj) { return json_encode($obj); }
    		public function decode($str) { return json_decode($str); }
    	}
    	$wp_json = new Services_JSON();
    }
    
    // if we don't have json class, get own PHP4 compatible library
    if (!isset($wp_json) || !is_a($wp_json, 'Services_JSON')) {
    	if (!class_exists('Services_JSON')) {
    		require_once( dirname(__FILE__) . '/JSON.php' );
    	}
    	$wp_json = new Services_JSON();
    }

    I recognize that the Tweet Blender JSON encoding was probably made to work with a wide variety of servers, but I believe that most people are now using PHP 5, which should provide a faster JSON encoding / decoding.

    I'm proposing that Tweet Blender consider revising the plugin to include the more efficient code. Any thoughts?

    http://wordpress.org/extend/plugins/tweet-blender/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic