$ brew remove thrift
$ brew edit thriftReplace the patch section with the following lines:
def patches| require 'formula' | |
| class Thrift < Formula | |
| homepage 'http://thrift.apache.org' | |
| # The thrift.apache.org 0.9.1 archive is missing PHP ext, fixed in THRIFT-2129 | |
| # By grapping the source from git instead, it's fixed, but we need to bootstrap | |
| url 'https://git-wip-us.apache.org/repos/asf/thrift.git', :branch => "0.9.1" | |
| version "0.9.1" | |
| head do |
| import datetime | |
| import functools | |
| from flask import ( | |
| current_app, | |
| make_response, | |
| request | |
| ) |
| import time | |
| import threading | |
| import dogpile.cache | |
| flag = 0 | |
| results = [0, 0] | |
| lock = threading.RLock() | |
| region = dogpile.cache.CacheRegion().configure("dogpile.cache.memory") |
| diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc | |
| index 08f2e68..42c4b33 100644 | |
| --- a/compiler/cpp/src/generate/t_py_generator.cc | |
| +++ b/compiler/cpp/src/generate/t_py_generator.cc | |
| @@ -838,8 +838,13 @@ void t_py_generator::generate_py_struct_reader(ofstream& out, | |
| "and fastbinary is not None:" << endl; | |
| indent_up(); | |
| - indent(out) << | |
| - "fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))" << endl; |
| def get_or_create_multi(self, keys, creator, expiration_time=None, | |
| should_cache_fn=None): | |
| def get_value(): | |
| value = values.get(key, NO_VALUE) | |
| if value is NO_VALUE or \ | |
| value.metadata['v'] != value_version or \ | |
| (self._invalidated and | |
| value.metadata["ct"] < self._invalidated): | |
| invalidated.append(key) |
| # -*- coding: utf-8 -*- | |
| import logging | |
| import multiprocessing | |
| import signal | |
| import time | |
| from thrift.transport import TTransport | |
| from thrift.server import TServer |
$ python benchmark.py
msgpack benchmark
7.78079032898
9.00101661682
ujson benchmark
12.1378898621
14.5480632782| ==> Downloading http://www.php.net/get/php-5.3.8.tar.gz/from/this/mirror | |
| File already downloaded in /Users/lxyu/Library/Caches/Homebrew | |
| /usr/bin/tar xf /Users/lxyu/Library/Caches/Homebrew/php-5.3.8 | |
| ==> Patching | |
| /usr/bin/patch -f -p1 -i 001-homebrew.diff | |
| patching file ext/tidy/tidy.c | |
| ==> ./configure --prefix=/usr/local/Cellar/php/5.3.8 --disable-debug --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/usr/local/etc/php5/conf.d --with-iconv-dir=/usr --enable-dba --enable-ndbm=/usr --enable-exif --enable-soap --enable-sqlite-utf8 --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-pcntl --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-zend-multibyte --enable-bcmath --enable-calendar --with-openssl=/usr --with-zlib=/usr --with-bz2=/usr --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-iodbc --with-kerberos=/usr --with-libxml-dir=/usr/local/Cellar/libxml2/2.7.8 --with-xsl=/usr --with-curl=/usr --with-gd --enable-gd-nat |