From ab3807792ae7e6ae2401d4d449abb14dbd9f6606 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier <laurent@bachelier.name> Date: Wed, 3 Oct 2012 21:54:58 +0200 Subject: [PATCH] Use faster json if available Considered faster according to: http://stackoverflow.com/questions/712791/json-and-simplejson-module-differences-in-python http://stackoverflow.com/questions/706101/python-json-decoding-performance As a side-effect, it might make irker work under Python versions older than 2.6. Signed-off-by: Eric S. Raymond <esr@thyrsus.com> --- irkerd | 4 +++- irkerhook.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/irkerd b/irkerd index 5785ce5..51e13c2 100755 --- a/irkerd +++ b/irkerd @@ -58,9 +58,11 @@ except ImportError: CONNECTION_MAX = 200 green_threads = False -import sys, json, getopt, urlparse, time, random +import sys, getopt, urlparse, time, random import threading, Queue, SocketServer import irc.client, logging +try: import simplejson as json +except ImportError: import json version = "1.5" diff --git a/irkerhook.py b/irkerhook.py index 4619310..0d1e284 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -37,8 +37,10 @@ default_channels = "irc://chat.freenode.net/%(project)s,irc://chat.freenode.net/ # No user-serviceable parts below this line: # -import os, sys, commands, socket, urllib, json +import os, sys, commands, socket, urllib from pipes import quote as shellquote +try: import simplejson as json +except ImportError: import json version = "1.5" -- 2.26.2