zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 48 forks source link

Different files, same size #106

Closed vexorian closed 10 years ago

vexorian commented 10 years ago

When the new file has exactly the same size as the old file, even when override is true, the new file won't be created. This brings issues when the old file somehow managed to be different and have the same size, something that happens usually when you are developing templates.

Some idea:

wookayin commented 10 years ago

How about using MD5 or SHA1 checksum?

zen0wu commented 10 years ago

Yes, Greed didn't do it because of performance consideration. But I guess it's OK to do this checking. Just read all the content of the file and do comparison.

vexorian commented 10 years ago

Since new file is already in memory and checksums need O(n) time, using hashes wouldn't really improve performance vs a file comparison.