giacomocavalieri / birdie

๐Ÿฆโ€โฌ› Snapshot testing in Gleam
https://hexdocs.pm/birdie/
Apache License 2.0
92 stars 6 forks source link

Better diff #1

Closed giacomocavalieri closed 9 months ago

JohnBjrk commented 9 months ago

@giacomocavalieri I saw that you replaced gap with another algorithm in this PR. Just got a bit curious about the reason just to understand if there is a use-case which gap currently doesn't support? (I'm the author of gap)

giacomocavalieri commented 9 months ago

Hello!! Yes I switched to a custom implementation because I wanted to use the histogram diffing algorithm and I didn't know how to get gap to use that when comparing two strings

JohnBjrk commented 9 months ago

Thanks for the response ๐Ÿ™ I'll have to look into the possibility of adding this algorithm at some point. My first implementation used a standard dynamic programming LCS algorithm, but then I switched to Myers as default in order to improve performance.

giacomocavalieri commented 9 months ago

Oh yeah I never made a PR to gap because the algorithm I wrote is hideous and might have horrible performance! I have some ideas on how it could be optimised but I'll probably only ever get around to doing it if people start complaining about performance ๐Ÿ˜†

JohnBjrk commented 9 months ago

I had a quick look at your implementation just to see if I could understand how the algorithm works and I saw that you had made some comments about performance optimizations. Also I didnโ€™t quite grasp how everything worked, but thatโ€™s probably more on me to not have read up on the algorithm properly.

Anyway if you want to adapt in and make a PR to gap you are of course more than welcome to. Otherwise I might see if I can figure something out at some point when I have some time.

tis 13 feb. 2024 kl. 20:51 skrev Giacomo Cavalieri @.***

:

Oh yeah I never made a PR to gap because the algorithm I wrote is hideous and might have horrible performance! I have some ideas on how it could be optimised but I'll probably only ever get around to doing it if people start complaining about performance ๐Ÿ˜†

โ€” Reply to this email directly, view it on GitHub https://github.com/giacomocavalieri/birdie/pull/1#issuecomment-1942303017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANC6YECCCKRNRBB6GZEMFDYTO72VAVCNFSM6AAAAABCU5EZO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBSGMYDGMBRG4 . You are receiving this because you commented.Message ID: @.***>

giacomocavalieri commented 9 months ago

If you want to learn more you can have a read here, it's a great resource https://tiarkrompf.github.io/notes/?/diff-algorithm/

My implementation is a translation of that algorithm with some tweaks for a pure functional setting