MCPcopy Create free account
hub / github.com/grantjenks/python-sortedcontainers / Ranking

Class Ranking

tests/benchmark_sortedlist.py:308–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306limit('multiset', 'List', 100000)
307
308class Ranking(Mixed):
309 def run(self, value):
310 """
311 40% getitem
312 40% index
313 10% add
314 10% remove
315 """
316 obj = self.obj
317 pos = self.rand.randrange(100)
318
319 if pos < 40:
320 if value < len(obj):
321 obj[value]
322 elif pos < 80:
323 assert obj.index(value) >= 0
324 elif pos < 90:
325 obj.add(value)
326 else:
327 obj.remove(value)
328
329for name, kind in kinds.items():
330 impls['ranking'][name] = {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected