Thinking about diffs, plain text diffs are typically compressed for transport anyway, so you end up with something that's human readable at the point of generation and application (where the storage/processing cost associated with legibility is basically insignificant) while being highly compressed during transport (where legibility is irrelevant and no processing beyond copying bits is necessary).
Mendoza: Use stack machines to compute efficient JSON diffs
11–20 of 35 posts
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#12Re: Mendoza: Use stack machines to compute efficient JSON diffs
#13I appreciate the Good Place reference in the name.
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#14Re: Mendoza: Use stack machines to compute efficient JSON diffs
#15Also works for XML, HTML, YAML and CSV.
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#16Interesting approach! But aren't JSON arrays a pretty wasteful encoding? Since this is an opaque serialization of an instruction set, why not try to encode more bits per number (JSON floats support lossless integers of many more bits), and moving the "symbol table" (string data) to the end? This way you could also compress redundant symbols into single strings.
Now that you have .TEXT and .DATA sections, you're only a few sentences away from suggesting that the compression/diff algorithm generate and send WASM's binary encoding.
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#17Why does this contain an implementation of sha256 instead of using the standard library's crypto/sha256?
At this point all of this is probably completely moot.
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#18Out of curiosity, what problem did you have that this approach solves? Thinking about diffs, plain text diffs are typically compressed for transport anyway, so you end up with something that's human readable at the point of generation and application (where the storage/processing cost associated with legibility is basically insignificant) while being highly compressed during transport (where legibility is irrelevant…
As a side effect, we've also been able to use the Mendoza format for tracking changes in documents. The JavaScript implementation supports replaying the patches while maintaining information about where each part of the document was introduced. We use this in our Review Changes feature so that you're able to see exactly who introduced a change (in a JSON document!): https://www.sanity.io/blog/review-changes
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#19I would love to get an understanding of how the HN crowd sees diffing datasets should be (lets say >1GB in size).
Are you more interested in a "patch" quality diff of the data which is more machine tailored? Or is a change report/summary/highlights more interesting in that case?
Currently I'm leaning more towards the understanding/human consumption perspective which offers some interesting tradeoffs.
Re: Mendoza: Use stack machines to compute efficient JSON diffs
#20You may find this relevant: https://github.com/ottypes/json1