mini-kep / parser-rosstat-kep

Provide clean macroeconomic time series as CSV files at stable URL
12 stars 13 forks source link

speed up manage.parse() #175

Closed epogrebnyak closed 6 years ago

epogrebnyak commented 6 years ago

manage.parse seems to run slower than its components, if correctly measured

Must use dev-slim branch for this task.

https://github.com/mini-kep/parser-rosstat-kep/blob/00440ec8bed7634e0a8bf20cbf867a8b789fffc8/src/manage.py#L214-L234

epogrebnyak commented 6 years ago

Current specific question is making dispatch.evaluate() run faster.

https://github.com/mini-kep/parser-rosstat-kep/blob/3155bad6b58aab886ee74b22dc9c2e6a919f5660/src/timer.py#L33-L35

epogrebnyak commented 6 years ago

Possible ways to go further:

epogrebnyak commented 6 years ago
def multithreading(func, args, 
                   workers):
    with ThreadPoolExecutor(workers) as ex:
        res = ex.map(func, args)
    return list(res)

def multiprocessing(func, args, 
                    workers):
    with ProcessPoolExecutor(work) as ex:
        res = ex.map(func, args)
    return list(res)