Calmcode - ray: overhead

Overhead

1 2 3 4 5

You can measure the overhead of ray with a small experiment.

import time

def just_sleep(t):
    time.sleep(0.0001)
    return t

@ray.remote
def ray_sleep(t):
    time.sleep(0.0001)
    return t

This command took 26.1s on our machine. It's quite long.

%%time
results = ray.get([ray_sleep.remote(t) for t in range(100_000)])

This code only took 13.4s on our machine. Much faster!

%%time
results = [just_sleep(t) for t in range(100_000)]