[med-svn] [mummer] 01/02: improve performance of delta2maf

Fabian Klötzl kloetzl-guest at moszumanska.debian.org
Fri Aug 5 12:57:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

kloetzl-guest pushed a commit to branch master
in repository mummer.

commit 18fabcc6f283447b45006ec47da03f1b182f1d6b
Author: Fabian Klötzl <fabian at kloetzl.info>
Date:   Fri Aug 5 14:25:49 2016 +0200

    improve performance of delta2maf
---
 .../0009-improve-performance-of-delta2maf.patch    | 56 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 57 insertions(+)

diff --git a/debian/patches/0009-improve-performance-of-delta2maf.patch b/debian/patches/0009-improve-performance-of-delta2maf.patch
new file mode 100644
index 0000000..885c402
--- /dev/null
+++ b/debian/patches/0009-improve-performance-of-delta2maf.patch
@@ -0,0 +1,56 @@
+From: =?utf-8?q?Fabian_Kl=C3=B6tzl?= <fabian at kloetzl.info>
+Date: Fri, 5 Aug 2016 14:14:02 +0200
+Subject: improve performance of delta2maf
+
+---
+ src/tigr/delta2maf.cc | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/src/tigr/delta2maf.cc b/src/tigr/delta2maf.cc
+index f397f35..f47d797 100644
+--- a/src/tigr/delta2maf.cc
++++ b/src/tigr/delta2maf.cc
+@@ -378,8 +378,8 @@ void printAlignments
+ 
+ {
+ 
+-  const char * IdR;
+-  const char * IdQ;
++  const char * IdR, *previous_IdR = NULL;
++  const char * IdQ, *previous_IdQ = NULL;
+ 
+   map<string, char *>::iterator finditer;
+ 
+@@ -405,6 +405,7 @@ void printAlignments
+   long int sR, eR, sQ, eQ;
+   long int Apos, Bpos;
+   long int SeqLenR, SeqLenQ;
++  long int previous_SeqLenR = 0, previous_SeqLenQ = 0;
+   int frameR, frameQ;
+ 
+   //for ( i = 0; i < LINE_PREFIX_LEN; i ++ )
+@@ -426,7 +427,23 @@ void printAlignments
+       //printf("Looking for R:\"%s\" in map of size %d\n",IdR,seqsMap.size());
+       assert(finditer != seqsMap.end());
+       R = finditer->second;
+-      SeqLenR = strlen(R+1);
++      // SeqLenR = strlen(R+1);
++
++      /**
++       * We don't want to recompute the length of a sequence for each
++       * iteration. This is especially important as many pairwise alignments
++       * are split into blocks and we thus do the same thing over and over
++       * again.
++       *
++       * My solution is to simply cache the current length value and reuse
++       * it in the next iteration given the IDs are equal. This speeds up
++       * the code by a factor of 20 (in words: twenty).
++       *
++       * -- Fabian Klötzl 2016-03-11
++       */
++      SeqLenR = IdR == previous_IdR ? previous_SeqLenR : strlen(R + 1);
++      previous_IdR = IdR;
++      previous_SeqLenR = SeqLenR;
+ 
+       if(DATA_TYPE == NUCMER_DATA){
+ 	seqsiter = seqsMapArray.find(make_pair(Ap->idR,1));
diff --git a/debian/patches/series b/debian/patches/series
index d618aa1..693d3e5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ hardening.patch
 spelling.patch
 addition_from_mugsy.patch
 addition_from_report_duplicates.patch
+0009-improve-performance-of-delta2maf.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mummer.git



More information about the debian-med-commit mailing list