From: Yann Simon <yann.simon.fr@gmail.com>
To: "Shawn O.Pearce" <spearce@spearce.org>,
Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [PATCH JGIT] Little performance optimization - replace the previous one
Date: Sat, 31 Jan 2009 15:19:26 +0100 [thread overview]
Message-ID: <1233411566.7844.11.camel@localhost> (raw)
- 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
reply other threads:[~2009-01-31 14:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233411566.7844.11.camel@localhost \
--to=yann.simon.fr@gmail.com \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).