主要是參考segmentfault的這篇
http://segmentfault.com/a/1190000000414339
看起來很有效,可是實際...
if __name__ == "__name__":
pool = Pool()
content = pool.map(transferConcat, [(obj_grab, content)])[0]
pool.close()
pool.join()
def concatMessage(obj_grab, content):
for logCatcher in obj_grab:
for key in logCatcher.dic_map:
regex = re.compile(key)
for j in range(len(content)):
for m in re.finditer(regex, content[j]):
content[j] += " " + logCatcher.index + " " + logCatcher.dic_map[key]
return content
def transferConcat(args):
return concatMessage(*args)
以上是我的代碼(部分,只貼問題點),執行時間22秒
若單純執行method大概也是22秒...等於沒加速...
我試過調整pool的數量,沒什麼效果
請問要怎麼做才能真正體現mulitiProcess的效能呢?