-
-
Save robertnishihara/1a5cbbc5f11b93708c9265d9df4fc27e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slow approach. | |
values = [1, 2, 3, 4, 5, 6, 7, 8] | |
while len(values) > 1: | |
values = [add.remote(values[0], values[1])] + values[2:] | |
result = ray.get(values[0]) | |
# Fast approach. | |
values = [1, 2, 3, 4, 5, 6, 7, 8] | |
while len(values) > 1: | |
values = values[2:] + [add.remote(values[0], values[1])] | |
result = ray.get(values[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment