Bill Allombert on Fri, 12 Mar 2004 10:35:22 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

marginal speed up of the GP interpretor


Hello,
Here a patch that (is supposed to) make a marginal speed up
in the interpretor.

A better way to proceed would be to add a return_type field to entree,
store the value at installation time and discard the matching letter
from the prototype. This is the way gp2c handle it.

Cheers,
Bill.
PS:
I have made a third snapshot of the new parser experiment.
<http://pari.math.u-bordeaux.fr/~bill/pari-2.2.8.bill-3.tar.bz2>

Index: src/language/anal.c
===================================================================
RCS file: /home/cvs/pari/src/language/anal.c,v
retrieving revision 1.157
diff -u -r1.157 anal.c
--- src/language/anal.c	26 Jan 2004 09:25:09 -0000	1.157
+++ src/language/anal.c	11 Mar 2004 21:51:10 -0000
@@ -1831,7 +1831,8 @@
       noparen=1; /* no argument, but valence is ok */
     }
     /* return type */
-    if      (*s == 'v') { ret = RET_VOID; s++; }
+    if      (*s <  'a')   ret = RET_GEN; 
+    else if (*s == 'v') { ret = RET_VOID; s++; }
     else if (*s == 'i') { ret = RET_INT;  s++; }
     else if (*s == 'l') { ret = RET_LONG; s++; }
     else                  ret = RET_GEN;
@@ -2011,11 +2012,11 @@
         err(talker2, "can't derive this", mark.identifier, mark.start);
       res = num_deriv(call, argvec);
     }
     else switch (ret)
     {
-      default: /* case RET_GEN: */
+      case RET_GEN:
 	res = ((PFGEN)call)(_ARGS_);
 	break;