Two minor tweaks.
This commit is contained in:
@@ -6,6 +6,7 @@ import benchmarks
|
|||||||
BYTES=1000
|
BYTES=1000
|
||||||
SIZE=1
|
SIZE=1
|
||||||
CONCURRENCY=50
|
CONCURRENCY=50
|
||||||
|
TRIES=5
|
||||||
|
|
||||||
def reader(sock):
|
def reader(sock):
|
||||||
expect = BYTES
|
expect = BYTES
|
||||||
@@ -82,16 +83,20 @@ if __name__ == "__main__":
|
|||||||
default=SIZE)
|
default=SIZE)
|
||||||
parser.add_option('-c', '--concurrency', type='int', dest='concurrency',
|
parser.add_option('-c', '--concurrency', type='int', dest='concurrency',
|
||||||
default=CONCURRENCY)
|
default=CONCURRENCY)
|
||||||
|
parser.add_option('-t', '--tries', type='int', dest='tries',
|
||||||
|
default=TRIES)
|
||||||
|
|
||||||
|
|
||||||
opts, args = parser.parse_args()
|
opts, args = parser.parse_args()
|
||||||
BYTES=opts.bytes
|
BYTES=opts.bytes
|
||||||
SIZE=opts.size
|
SIZE=opts.size
|
||||||
CONCURRENCY=opts.concurrency
|
CONCURRENCY=opts.concurrency
|
||||||
|
TRIES=opts.tries
|
||||||
|
|
||||||
funcs = [launch_green_threads]
|
funcs = [launch_green_threads]
|
||||||
if opts.threading:
|
if opts.threading:
|
||||||
funcs = [launch_green_threads, launch_heavy_threads]
|
funcs = [launch_green_threads, launch_heavy_threads]
|
||||||
results = benchmarks.measure_best(3, 3,
|
results = benchmarks.measure_best(TRIES, 3,
|
||||||
lambda: None, lambda: None,
|
lambda: None, lambda: None,
|
||||||
*funcs)
|
*funcs)
|
||||||
print "green:", results[launch_green_threads]
|
print "green:", results[launch_green_threads]
|
||||||
|
@@ -49,7 +49,7 @@ class Pool(object):
|
|||||||
|
|
||||||
http_pool = pools.Pool(create=lambda: httplib2.Http(timeout=90))
|
http_pool = pools.Pool(create=lambda: httplib2.Http(timeout=90))
|
||||||
|
|
||||||
or `functools.partial`::
|
or :func:`functools.partial`::
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
http_pool = pools.Pool(create=partial(httplib2.Http, timeout=90))
|
http_pool = pools.Pool(create=partial(httplib2.Http, timeout=90))
|
||||||
|
Reference in New Issue
Block a user