This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在macbook pro 4核上的测试结果,python自带的map表现比起ipython 的map,list comprehensions都要好。但是有优化的multi_mcpi还是不错。 | |
$ ipcluster start --n=4 | |
print mcpi(100000000) | |
#print multi_mcpi_by_map(dview, 100000000) # 传递太耗时 | |
#print multi_mcpi_by_list_comp(dview, 100000000) | |
#print multi_mcpi(dview, 100000000) | |
$ time py multi_mcpi.py | |
importing random from random on engine(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
__doc__ = """Tiny HTTP Proxy. | |
This module implements GET, HEAD, POST, PUT and DELETE methods | |
on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT | |
method is also implemented experimentally, but has not been | |
tested yet. | |
Any help will be greatly appreciated. SUZUKI Hisao |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3, | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time() | |
result = method(*args, **kw) | |
te = time() | |
logging.info('%r %2.2f sec' % (method.__name__, te-ts)) | |
return result | |
return timed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index_text用法 replace | |
[2013-03-21 22:44:49] folder[_hehe_2011-08-21] num indexed: 350000 | |
[2013-03-21 22:44:57] folder[_hehe_2010-12-14] num indexed: 360000 | |
[2013-03-21 22:45:05] folder[_hehe_2010-12-14] num indexed: 370000 | |
[2013-03-21 22:45:11] folder[_hehe_2010-04-08] num indexed: 380000 | |
[2013-03-21 22:45:17] folder[_hehe_2010-10-25] num indexed: 390000 | |
[2013-03-21 22:45:25] folder[_hehe_2011-07-02] num indexed: 400000 | |
[2013-03-21 22:45:34] folder[_hehe_2011-10-10] num indexed: 410000 | |
[2013-03-21 22:45:43] folder[_hehe_2011-02-02] num indexed: 420000 | |
[2013-03-21 22:45:51] folder[_hehe_2011-02-02] num indexed: 430000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/.bashrc | |
alias gcc='/usr/local/bin/gcc' | |
export CC=/usr/local/bin/gcc | |
export CXX=/usr/local/bin/g++ | |
CFLAGS="-O3 -g -fno-exceptions -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing" | |
CXXFLAGS="-O3 -g -fno-exceptions -fno-rtti -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing" | |
export CFLAGS CXXFLAGS | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/scws/lib/:/home/arthas/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/sbin | |
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu | |
export PATH=$PATH:/usr/local/tokutek/mysql/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [29]: class foo(): | |
....: def __init__(self): | |
....: self.__x = 1 | |
....: | |
In [30]: r1 = foo() | |
In [31]: r1.__x | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [88]: class C: | |
....: def foo(self): | |
....: pass | |
....: foo = classmethod(foo) | |
....: | |
In [89]: C.__dict__ | |
Out[89]: | |
{'__doc__': None, | |
'__module__': '__main__', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 1.txt 2013-11-20 21:24:35.000000000 +0800 | |
+++ 2.txt 2013-11-20 21:24:35.000000000 +0800 | |
@@ -1,4 +1,4 @@ | |
- 309378992 function calls in 596.173 seconds | |
+ 309378992 function calls in 592.411 seconds | |
Ordered by: standard name | |
@@ -89,13 +89,13 @@ | |
1 0.000 0.000 0.000 0.000 __init__.py:705(NetworkError) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 1.txt 2013-11-20 21:24:35.000000000 +0800 | |
+++ 3.txt 2013-11-20 21:24:35.000000000 +0800 | |
@@ -1,4 +1,4 @@ | |
- 309378992 function calls in 596.173 seconds | |
+ 309378996 function calls in 9818.898 seconds | |
Ordered by: standard name | |
@@ -33,7 +33,7 @@ | |
1 0.000 0.000 0.000 0.000 __init__.py:2732(ExpandDecider) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 141990135 function calls in 4517.825 seconds | |
+ 141990135 function calls in 305.731 seconds | |
- 15732127 35.384 0.000 41.229 0.000 __init__.py:6549(__init__) | |
+ 15732127 27.876 0.000 32.483 0.000 __init__.py:6549(__init__) | |
class TermListItem(object): | |
def __init__(self, iter, term): | |
self._iter = iter | |
self.term = term | |
self._wdf = None |
OlderNewer