Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Add benchmark using queue (ray-project#2431)
Browse files Browse the repository at this point in the history
  • Loading branch information
pschafhalter authored and pcmoritz committed Jul 19, 2018
1 parent 8e75d15 commit 4225ac5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions python/benchmarks/benchmark_queue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import ray
from ray.experimental.queue import Queue


def setup():
if not hasattr(setup, "is_initialized"):
ray.init(num_workers=4, num_cpus=4)
setup.is_initialized = True


class QueueSuite(object):
def time_put(self):
queue = Queue(1000)
for i in range(1000):
queue.put(i)

def time_get(self):
queue = Queue()
for i in range(1000):
queue.put(i)
for _ in range(1000):
queue.get()

def time_qsize(self):
queue = Queue()
for _ in range(1000):
queue.qsize()

0 comments on commit 4225ac5

Please sign in to comment.