[Xastir-dev] Awk.c optimization

John Laxson jlaxson at mac.com
Tue Apr 26 17:17:47 EDT 2005


Hi all,

I would like to submit this small one-liner optimization for awk.c.   
It appears that, in Darwin at least, calling toupper() does a whole  
bunch of junk with pthreads.  (Shark profile available if you're  
interested).   I'm not exactly sure why this happens, but it halved  
my map display time.

73,
John KC0PZN

diff -u -r1.25 awk.c
--- awk.c       8 Jan 2005 10:06:51 -0000       1.25
+++ awk.c       26 Apr 2005 21:10:30 -0000
@@ -184,9 +184,10 @@
      // Create holding spot for both cases of first character, in
      // order to speed up the loop below.
-    c = toupper(name[0]);
+    /*c = toupper(name[0]);*/
      d = name[0];
-
+       c = (d >= 'a' && d <= 'z' ? d - 32 : d); /* poor (speed)  
man's toupper */
+
      // Check through the hash
      //
      for (s = this->hash[AWK_SYM_HASH(name,len)]; s; s = s->next_sym) {




More information about the Xastir-dev mailing list