-
Notifications
You must be signed in to change notification settings - Fork 7
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
Computing Ion hash is slow for larger Ion inputs #21
Comments
I've investigated the possibility of using the C extension for Currently, ion-hash-python works overall like this (source code is from here, comments added by me): # Creates a custom ion_writer that keeps a running hash value
hw = hash_writer(blocking_writer(binary_writer(), BytesIO()), hfp)
# Writes the Ion value to the custom ion_writer
_dump(self, hw, _FROM_TYPE)
hw.send(ION_STREAM_END_EVENT)
# Signals the custom writer to output the current hash value
return hw.send(HashEvent.DIGEST) The In theory, one could create a custom The other, more reasonable option (in my opinion) is to call |
Reference issue: awslabs/amazon-qldb-driver-python#67
For the following document,
ion_hash
takes ~2.5 ms and native hash takes < 0.01 ms.$ion_1_0 { id:"0001", type:"donut", name:"Cake", ppu:0.55, batters:{ batter:[ { id:"1001", type:"Regular" }, { id:"1002", type:"Chocolate" }, { id:"1003", type:"Blueberry" }, { id:"1004", type:"Devil's Food" } ] }, topping:[ { id:"5001", type:"None" }, { id:"5002", type:"Glazed" }, { id:"5005", type:"Sugar" }, { id:"5007", type:"Powdered Sugar" }, { id:"5006", type:"Chocolate with Sprinkles" }, { id:"5003", type:"Chocolate" }, { id:"5004", type:"Maple" } ] }
ion_hash
function internally uses thereader
andwriter
fromion-python
implementation, it might be worth trying out new C extension work aroundion-python
which improves performance ofreader
andwriter
.The text was updated successfully, but these errors were encountered: