Skip to content
Advertisement

Ray has weird time consuming

I have a tiny Ray pipeline like this:

JavaScript

I using time.sleep() for fake time consuming. As you can see, the HandDetector should running in a sub process, so the whole time should be 6s.

But I got (you can have a try on your computer):

JavaScript

Why there are 0.4s time more?

Advertisement

Answer

It looks like you posted the same question to the Ray GitHub (link to comment). I am copying the answer here so other StackOverflow users can benefit.

@robertnishihara: You are recreating the actors every time you call do_it, and there is some overhead to creating actors (it starts a new Python process).

If you rewrite it as follows, the overhead drops.

JavaScript

In this case, I get the output

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement