Live data from Hacker News

Mendoza: Use stack machines to compute efficient JSON diffs

sanity.io

31–35 of 35 posts

Re: Mendoza: Use stack machines to compute efficient JSON diffs

#31
“ Naming a project is always difficult. Since this project is focused on representing changes between JSON documents I naturally started thinking about names like "JSON differ, JSON changes, JSON patch, …". However, most of these names have already been used by existing projects. While I was muttering "JSON, JSON, JSON" it suddenly turned into "JSON, JSON, Jason, Jason Mendoza".”

This is a reference from The Good Place and it is an amazing name!

Re: Mendoza: Use stack machines to compute efficient JSON diffs

#32
post #18

Out 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…

We have a JSON data store at Sanity.io where you update your data by sending in a transaction script which is at a quite high level ("increment karma by 5"). While these scripts explain your intention well, they are a bit of a hassle to work with internally since the language is so rich. We therefore wanted (what we've called) an effect format . The effect format would explain what actually happened when applying the…

Ah, so you're using it in a transport context that has no (built-in) compression?

Re: Mendoza: Use stack machines to compute efficient JSON diffs

#33
post #25
post #15

This is an interesting tool for computing minimal diffs, but the result is not very human friendly. If this is your goal and you are looking for something better than diff, have a look at graphtage: https://github.com/trailofbits/graphtage Also works for XML, HTML, YAML and CSV.

Would be cool if there is were a way to plug this into git

I'm pretty sure git allows custom diffs, no?

Re: Mendoza: Use stack machines to compute efficient JSON diffs

#34
post #15

This is an interesting tool for computing minimal diffs, but the result is not very human friendly. If this is your goal and you are looking for something better than diff, have a look at graphtage: https://github.com/trailofbits/graphtage Also works for XML, HTML, YAML and CSV.

Thanks for sharing that! Looks usefull to me
Post reply on HN