Changeset: c084b62236b9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c084b62236b9
Modified Files:
        monetdb5/mal/mal_type.c
        monetdb5/mal/mal_type.h
Branch: Apr2012
Log Message:

strcmp is builtin in gcc, so use that.
idcmp tried to be smart by comparing the first characters of both
inputs and only call strcmp when they are the same.  However, it costs
a function call no matter what (except in the file mal_type.c where it
is supposed to be inlined).  The builtin version of strcmp can do
better.


diffs (42 lines):

diff --git a/monetdb5/mal/mal_type.c b/monetdb5/mal/mal_type.c
--- a/monetdb5/mal/mal_type.c
+++ b/monetdb5/mal/mal_type.c
@@ -115,15 +115,6 @@ getTypeIdentifier(malType tpe){
  * Use the information that identifiers are at least one character
  * and are terminated by a null to speedup comparison
  */
-inline int
-idcmp(str n, str m)
-{
-       assert(n != NULL);
-       assert(m != NULL);
-       if (*n == *m)
-               return strcmp(n, m);
-       return -1;
-}
 
 /*
  * @-
@@ -194,8 +185,8 @@ getTypeIndex(str nme, int len, int defty
                nme[k] = 0;
        }
        for(i= TYPE_str; i< GDKatomcnt; i++)
-       if( BATatoms[i].name[0]==nme[0] &&
-               strcmp(nme,BATatoms[i].name)==0) break;
+               if( BATatoms[i].name[0]==nme[0] &&
+                       strcmp(nme,BATatoms[i].name)==0) break;
        if( len > 0)
                nme[k]=old;
        if (i == GDKatomcnt)
diff --git a/monetdb5/mal/mal_type.h b/monetdb5/mal/mal_type.h
--- a/monetdb5/mal/mal_type.h
+++ b/monetdb5/mal/mal_type.h
@@ -82,7 +82,7 @@ mal_export str getTypeIdentifier(malType
 mal_export int getTypeIndex(str nme, int len, int deftpe);
 mal_export malType reverseBatType(malType v);
 mal_export malType malAnyBatType(malType t1, malType t2);
-mal_export int idcmp(str n, str m);
+#define idcmp(n, m)    strcmp(n, m)
 mal_export str newTmpName(char tag, int i);
 mal_export int isTmpName(str n);
 mal_export int isTypeName(str n);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to