git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH JGIT] Little performance optimization - replace the previous one
@ 2009-01-31 14:19 Yann Simon
  0 siblings, 0 replies; only message in thread
From: Yann Simon @ 2009-01-31 14:19 UTC (permalink / raw)
  To: Shawn O.Pearce, Robin Rosenberg; +Cc: git

- avoid one if
- avoid to calculate 2 times the same value

Signed-off-by: Yann Simon <yann.simon.fr@gmail.com>
---
 .../src/org/spearce/jgit/lib/GitIndex.java         |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
index 454b540..6eeccff 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
@@ -411,11 +411,9 @@ Entry(ByteBuffer b) {
                 * @throws IOException
                 */
                public boolean update(File f) throws IOException {
-                       boolean modified = false;
                        long lm = f.lastModified() * 1000000L;
-                       if (mtime != lm)
-                               modified = true;
-                       mtime = f.lastModified() * 1000000L;
+                       boolean modified = mtime != lm;
+                       mtime = lm;
                        if (size != f.length())
                                modified = true;
                        if (config_filemode()) {
--
1.6.0.6

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-31 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31 14:19 [PATCH JGIT] Little performance optimization - replace the previous one Yann Simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).