- Added some code optimizations after using gprof.
This commit is contained in:
parent
ff0c29142e
commit
a588c90952
5
src/scytherprof
Executable file
5
src/scytherprof
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
scons gprof=yes
|
||||||
|
./scyther $*
|
||||||
|
gprof --flat-profile scyther
|
@ -109,25 +109,28 @@ termlistDestroy (Termlist tl)
|
|||||||
|
|
||||||
//! Determine whether a term is an element of a termlist.
|
//! Determine whether a term is an element of a termlist.
|
||||||
/**
|
/**
|
||||||
|
* Term must be non-null.
|
||||||
|
*
|
||||||
*@return True iff the term is an element of the termlist.
|
*@return True iff the term is an element of the termlist.
|
||||||
*/
|
*/
|
||||||
int
|
__inline__ int
|
||||||
inTermlist (Termlist tl, Term term)
|
inTermlist (Termlist tl, const Term term)
|
||||||
{
|
|
||||||
if (tl == NULL)
|
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
if (term == NULL)
|
if (term == NULL)
|
||||||
return 1;
|
{
|
||||||
else
|
error ("Trying to do inTermlist for a NULL term.");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else
|
#endif
|
||||||
|
while (tl != NULL)
|
||||||
{
|
{
|
||||||
if (isTermEqual (tl->term, term))
|
if (isTermEqual (tl->term, term))
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
else
|
|
||||||
return inTermlist (tl->next, term);
|
|
||||||
}
|
}
|
||||||
|
tl = tl->next;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Equality of two term lists.
|
//! Equality of two term lists.
|
||||||
|
@ -28,7 +28,7 @@ Termlist termlistShallow (Termlist tl);
|
|||||||
void termlistDelete (Termlist tl);
|
void termlistDelete (Termlist tl);
|
||||||
void termlistDestroy (Termlist tl);
|
void termlistDestroy (Termlist tl);
|
||||||
void termlistPrint (Termlist tl);
|
void termlistPrint (Termlist tl);
|
||||||
int inTermlist (Termlist tl, Term term);
|
int inTermlist (Termlist tl, const Term term);
|
||||||
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
||||||
Termlist termlistAdd (Termlist tl, Term term);
|
Termlist termlistAdd (Termlist tl, Term term);
|
||||||
Termlist termlistAppend (const Termlist tl, const Term term);
|
Termlist termlistAppend (const Termlist tl, const Term term);
|
||||||
|
Loading…
Reference in New Issue
Block a user