I'm testing dask and i can't understand how dask is slower that plain python. I was developed in jupyer two examples to get the time for each, and i think that i am doing something wrong
The first with dask: 28.5 seconds and after in plain python 140 ms
import dask
import dask.array as da
%%time
def inc(x):
return x + 1
def double(x):
return x + 2
def add(x, y):
return x + y
N = 100000
data = [0 for x in range(N)]
x = da.from_array(data, chunks=(1000))
output = []
for x in data:
a = dask.delayed(inc)(x)
b = dask.delayed(double)(x)
c = dask.delayed(add)(a, b)
output.append(c)
total = dask.delayed(sum)(output)
total.compute()
**28.8 seconds**
Now with plain python
%%time
def inc(x):
return x + 1
def double(x):
return x + 2
def add(x, y):
return x + y
N = 100000
data = [0 for x in range(N)]
output = []
for x in data:
a = inc(x)
b = double(x)
c = add(a, b)
output.append(c)
total = sum(output)
**140 milliseconds**