gritzko / swarm

JavaScript replicated model (M of MVC) library
http://swarmdb.net/
MIT License
2.68k stars 97 forks source link

Lambdafu/bug op compression #93

Closed lambdafu closed 6 years ago

lambdafu commented 6 years ago

Hi! I spent some time staring at the compression function, and eventually it occured to me that had_origin dependend only on the location UUID (the value of "def" after the inner loop), and not on any of the other UUIDs. Which didn't make much sense, so I worked my way backwards to find a test case. If the stars are aligned, separators can be skipped and cause an identifier to be interpreted as origin of the previous UUID.

I was impressed how compact the compression function is and how much it achieves in just a few lines! Nice work!

To make it easier for testing, I also refactored the decompression function from Frame into the Op class.

gritzko commented 6 years ago

Hi Marcus!

Somehow, I missed the notification. I was working on the golang version at the time. http://github.com/gritzko/ron There, I made my best to cover 100% of the cases: https://github.com/gritzko/ron/blob/master/parse_test.go#L75 Hopefully, those tests get into this repo one day.

Right now, I am rotating the repo to the new Swarm/RON rewrite currently curated by @olebedev.

lambdafu commented 6 years ago

Thanks for pointing out the golang version! I hope to get back to swarm for a js app some time, but I have to admit I got sidetracked in the last couple months. Happy to hear things are moving :)