[ANN] editscript: a diffing library for Clojure data

166 views
Skip to first unread message

hy...@juji-inc.com

unread,
May 1, 2018, 2:52:08 AM5/1/18
to Clojure
Hello,

I am happy to make available a diffing/patching library for Clojure data structures. 

https://github.com/juji-io/editscript

Two flavors of diffing algorithms are provided, with very different performance characteristics, suitable for different applications. 

* One optimizing diffing algorithm aimed to reduce the size of diffs. It is an A* based graph search algorithm that is optimized for speed, though much slower than the next one, it is still practical.
* Another is a straightforward tree walking algorithm that is about two orders of magnitude faster, but produce suboptimal results.

Hope this library will be of some use for someone. Comments, suggestions and contributions are also welcome.

-huahai

Colin Fleming

unread,
May 2, 2018, 7:34:42 PM5/2/18
to clo...@googlegroups.com
This looks very nice, thank you!

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Luetzelschwab

unread,
May 3, 2018, 5:59:07 AM5/3/18
to clo...@googlegroups.com
Thanks for sharing!

Last time I was looking for something similar, I came across this library -


It works for both Clojure and ClojureScript, although it's specific for either maps or vectors.

I haven't looked at the specific implementations of either library and only used it on small data sets, so can't comment on suitability for your use cases.

I thought I'll share since your readme mentioned you didn't find any prior implementations and for anyone looking at this thread in the future.

-Alpeware

On Thu, May 3, 2018, 12:34 AM Colin Fleming <colin.ma...@gmail.com> wrote:
This looks very nice, thank you!
On 1 May 2018 at 06:52, <hy...@juji-inc.com> wrote:
Hello,

I am happy to make available a diffing/patching library for Clojure data structures. 

https://github.com/juji-io/editscript

Two flavors of diffing algorithms are provided, with very different performance characteristics, suitable for different applications. 

* One optimizing diffing algorithm aimed to reduce the size of diffs. It is an A* based graph search algorithm that is optimized for speed, though much slower than the next one, it is still practical.
* Another is a straightforward tree walking algorithm that is about two orders of magnitude faster, but produce suboptimal results.

Hope this library will be of some use for someone. Comments, suggestions and contributions are also welcome.

-huahai

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

hy...@juji-inc.com

unread,
May 3, 2018, 12:11:35 PM5/3/18
to Clojure
My readme specifically mentioned https://github.com/friemen/diffit, where I said:

>...The same sequence diffing algorithm is also implemented in diffit. Using their benchmark, our implementation has slightly better performance due to more optimizations. Keep in mind that our algorithm also handles nested Clojure data structures. ...

That is to say, diffit only does map and vector diffing *separately*, so you cannot really use it as a *Clojure data structure* diffing library. Hope this helps.

Cheers.

-huahai

Simon Luetzelschwab

unread,
May 3, 2018, 1:08:27 PM5/3/18
to clo...@googlegroups.com
My apologies, missed the reference further below since you mentioned you did not find any libraries in your intro text. 


For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alpeware LLC - 548 Market St #35286, San Francisco, CA 94104 - +1 415 200 3094

Gregg Reynolds

unread,
May 3, 2018, 2:11:55 PM5/3/18
to clo...@googlegroups.com


On Tue, May 1, 2018, 1:52 AM <hy...@juji-inc.com> wrote:
Hello,

I am happy to make available a diffing/patching library for Clojure data structures. 

That looks very good!  Am I right that this could be used along with e.g. data.xml (https://github.com/clojure/data.xml) to do XML diffing?

Thanks!

Gregg

Huahai Yang

unread,
May 3, 2018, 2:31:43 PM5/3/18
to clo...@googlegroups.com
My understanding is that data.xml returns data as defrecords and they implements IPersistentMap, so I think editscript should work for data.xml. Please let me know how it goes if you do try. The performance should be good as maps are cheap to diff. 

Currently, anything implements IPersistentMap, IPersistentVector, IPersistentSet and IPersistentList would be treated as potential internal tree nodes by editscript and would be drilled down for comparison. Anything else is treated as tree leaves at this moment.

Cheers.

-huahai

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/f6VlkssviAM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
__________________
Huahai Yang, Ph.D.
Co-founder and CTO
Juji, Inc.
Reply all
Reply to author
Forward
0 new messages