{"id":21970687,"url":"https://github.com/sirwumpus/ioccc-npdif","last_synced_at":"2025-03-22T22:43:47.514Z","repository":{"id":98631467,"uuid":"90909944","full_name":"SirWumpus/ioccc-npdif","owner":"SirWumpus","description":"Most Different (diff) - IOCCC 2015 Winner","archived":false,"fork":false,"pushed_at":"2023-01-03T20:05:27.000Z","size":62,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T02:26:49.733Z","etag":null,"topics":["c","diff","file-comparison","ioccc","posix"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SirWumpus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-10T21:28:16.000Z","updated_at":"2022-12-20T12:26:13.000Z","dependencies_parsed_at":"2023-03-07T10:30:23.652Z","dependency_job_id":null,"html_url":"https://github.com/SirWumpus/ioccc-npdif","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SirWumpus%2Fioccc-npdif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SirWumpus%2Fioccc-npdif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SirWumpus%2Fioccc-npdif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SirWumpus%2Fioccc-npdif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SirWumpus","download_url":"https://codeload.github.com/SirWumpus/ioccc-npdif/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245031362,"owners_count":20549913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","diff","file-comparison","ioccc","posix"],"created_at":"2024-11-29T14:41:47.377Z","updated_at":"2025-03-22T22:43:47.497Z","avatar_url":"https://github.com/SirWumpus.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"README\n------\n\nTo Build\n--------\n\n\t\t$ cc -o prog prog.c\n\n\nUsage Examples\n--------------\n\n\t\t$ ./prog file1 file2\n\n\t\t$ ./prog -d file1 file2\n\n\t\t$ ./prog-test.sh\n\n\nFeatures\n--------\n\n* \"An O(NP) Sequence Comparison Algorithm\" by Wu, Manber, Myers, Miller.\n\n* Output compatible with patch(1).\n\n* Strokes one of the judge's ego (I couldn't email chocolate or curry).\n\n\nDescription\n-----------\n\nThis is a functioning micro diff tool using an [O(NP) algorithm][Wu+89], compared to the older [O(ND) difference algorithm][Mye86] used by some versions of diff.  Its output is based on the default diff(1) output described by POSIX and [The Open Group Base Specifications][SUSV7].  The output is suitable for use with patch(1).\n\nThe -d option simply writes the edit distance between file1 and file2.\n\n\nObservations\n------------\n\nThe FNV1a hash is a little slow compared to the trival hash GNU Diff uses.  I downloaded a plain text copy of \"War And Peace\" from Project Gutenberg, used ``makeholes.c`` to make 1000 random changes, then profiled and timed the program verses GNU Diff.  The bottle neck appears to be in the file I/O and line hashing with an average +0.05s slower.  Using a huge file like \"War And Peace\" for testing offsets the diff(1) optimised file I/O.\n\nThere is no hash collision checking, partly because FNV1a appears to generate very [few collisions][HshCmp] and an assumption that localised collisions within a region of edits are highly unlikely.\n\n\nSupport Files\n-------------\n\n* ``prog-test.sh``  \nBasic test program verifies known test edit distances and patch support.\n\n* ``avgtime.sh``\n\n* ``makeholes.c``  \nRandom edits (holes) made to a file in-place.\n\n\nReferences\n----------\n\nWu, Manber, Myers, and Miller; August 1989;  \n\"An O(NP) Sequence Comparison Algorithm\";  \n\u003chttp://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf\u003e\n\t\nFowler, Noll, Vo; 1994  \n\u003chttp://www.isthe.com/chongo/tech/comp/fnv/index.html\u003e\n\nFowler, Noll, Vo on Wikipedia  \n\u003chttps://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\u003e\n\n\"diff\", The Open Group Base Specifications Issue 7  \nIEEE Std 1003.1, 2013 Edition  \n\u003chttp://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html\u003e\n\nEugene W. Myers; \"An O(ND) Difference Algorithm and Its Variations\";  \nAlgorithmica, 1986, pages. 251-266  \n\u003chttp://www.xmailserver.org/diff2.pdf\u003e\n\nWebb Miller and Eugene W. Myers; \"A File Comparison Program\";  \nSoftware-Practice And Experience, Vol. 15(11). 1025-1040 (November 1985)  \n\u003chttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.189.70\u0026rep=rep1\u0026type=pdf\u003e\n\nD.S. Hirschberg, \"A linear space algorithm for computing maximal common subsequence problem\";  \nComm. of ACM, Vol. 18, June 1975, pages 341-343  \n\u003chttp://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/DynProg/Docs/Hirschberg-LCS-1975.pdf\u003e\n\nWhich hashing algorithm is best for uniqueness and speed?  \n\u003chttp://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed\u003e\n\n[Wu+89]: http://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf\n\n[FNV94]: http://www.isthe.com/chongo/tech/comp/fnv/index.html\n\n[FNVWi]: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\n\n[Mye86]: http://www.xmailserver.org/diff2.pdf\n\n[SUSV7]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html\n\n[Mil85]: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.189.70\u0026rep=rep1\u0026type=pdf\n\n[Hir75]: http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/DynProg/Docs/Hirschberg-LCS-1975.pdf\n\n[HshCmp]: http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirwumpus%2Fioccc-npdif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsirwumpus%2Fioccc-npdif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirwumpus%2Fioccc-npdif/lists"}