-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement functions for working with binary keyvalues #3
Comments
Also used in the |
I finished the first version of the parse_binary function. Some notes:
Additionally, i am not sure if creating the Edit: |
Let's just deal with bytes strings. Then we can use indexing and slicing to parse it. I suggest >>> x = b'bbb\x00aaaa\x00'
>>> x[0: x.find(b'\x00', 0)]
b'bbb'
>>> x[4: x.find(b'\x00', 4)]
b'aaaa' If we want to make load/dump symmetric then the only way is to use objects for point, widestring, and color. |
I think that covers everything. I haven't tested it on any real data yet. |
I am almost finished with my version, too. IMHO it is a bit cleaner. Changes:
So far i tested it with all the packages i could get from steam, and deserializeing them and serializing them again returned the correct results. If you want i could merge your changes with mine ? |
Did you see my implementation? It's feature complete and fully tested. Here is quick perf comparison. In [1]: import vdf, vdf_binary
In [2]: raw = vdf.binary_dumps(dict(map(lambda x: (str(x), x),
range(5000))))
In [3]: %timeit vdf.binary_loads(raw)
100 loops, best of 3: 15.1 ms per loop
In [4]: %timeit vdf_binary.parse(raw)
10 loops, best of 3: 54.1 ms per loop
In [5]: raw = vdf.binary_dumps(dict(map(lambda x: (str(x), str(x)*100),
range(5000))))
In [6]: %timeit vdf.binary_loads(raw)
100 loops, best of 3: 15 ms per loop
In [7]: %timeit vdf_binary.parse(raw)
10 loops, best of 3: 103 ms per loop |
Well, your parsing version doesn't support streams (and therefore is ofc faster with memory data ;)), but i can live with that. Some stuff i noticed:
|
Good news everybody, Every single binary vdf blob i tested only contained int32 and string types btw. |
Those are used in richpresence and other places, would be useful for the
steam
module eventually.More info:
SteamRE/SteamKit#108
The text was updated successfully, but these errors were encountered: