[meld] Short-circuit file time comparison when we don't need Decimal precision
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Short-circuit file time comparison when we don't need Decimal precision
- Date: Sat, 9 Feb 2013 22:18:56 +0000 (UTC)
commit b42db6f6348b27f7361eab632e5a069076f8061b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Feb 10 07:44:12 2013 +1000
Short-circuit file time comparison when we don't need Decimal precision
meld/dirdiff.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 7bcfbb3..08e29fb 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -64,6 +64,11 @@ class StatItem(namedtuple('StatItem', 'mode size time')):
if self.size != other.size:
return False
+ # Shortcut to avoid expensive Decimal calculations. 2 seconds is our
+ # current accuracy threshold (for VFAT), so should be safe for now.
+ if abs(self.time - other.time) > 2:
+ return False
+
dectime1 = Decimal(str(self.time)).scaleb(Decimal(9)).quantize(1)
dectime2 = Decimal(str(other.time)).scaleb(Decimal(9)).quantize(1)
mtime1 = dectime1 // prefs.dirdiff_time_resolution_ns
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]