The original code was:
strcat ($1.buf, $2);
this is changed into
strcpy ($1.buf + $1.strlen, $2);

As strcat needs to scan the string to find the end
and the string can become quite long this can take
quite some time.
Since we already have the len of the string we can
immediately go to the end of the string and strcpy there

Gain increases with the length of the design but for a 2.4 MB svf
file the gain processing the data reduced by 30 % (from 5.3 to 3.6
seconds on my system)

Signed-off-by: Frans Meulenbroeks <[email protected]>
---
 urjtag/src/svf/svf_bison.y |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/urjtag/src/svf/svf_bison.y b/urjtag/src/svf/svf_bison.y
index 979c583..92aacc2 100644
--- a/urjtag/src/svf/svf_bison.y
+++ b/urjtag/src/svf/svf_bison.y
@@ -312,7 +312,7 @@ hexa_num_sequence
                      $1.buflen = newlen;
                  }
                  if ($1.buf != NULL) {
-                     strcat ($1.buf, $2);
+                     strcpy ($1.buf + $1.strlen, $2);
                      $1.strlen += frag_len;
                  }
                  free ($2);
-- 
1.7.0.4


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to