Created
October 3, 2011 20:44
-
-
Save ericmoritz/1260188 to your computer and use it in GitHub Desktop.
LWWSet test
This file contains hidden or 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
| (env)Erics-MacBook-Pro:crdt eric$ python /tmp/millionkeys.py | |
| Add: | |
| 0.573606014252 | |
| Serialize: | |
| 0.552729129791 | |
| Sort, Slice: | |
| 0.511281967163 | |
| Deserialize: | |
| 0.156991004944 |
This file contains hidden or 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
| import msgpack | |
| from crdt.sets import LWWSet | |
| from time import time | |
| import json | |
| NUM_KEYS = 1000000 | |
| s = LWWSet() | |
| start = time() | |
| for i in xrange(NUM_KEYS): | |
| s.add(i) | |
| print "Add:" | |
| print time() - start | |
| start = time() | |
| x = msgpack.dumps(s.payload) | |
| print "Serialize:" | |
| print time() - start | |
| start = time() | |
| start_n = 100000 | |
| page = sorted(s.value)[start_n:start_n+25] | |
| print "Sort, Slice:" | |
| print time() - start | |
| start = time() | |
| news = LWWSet.from_payload(msgpack.loads(x)) | |
| print "Deserialize:" | |
| print time() - start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment