[CM] pre-parsing scheme code

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Mon Mar 21 12:17:20 PDT 2022


I didn't realize there was such a difference in speed:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "s7.h"

int main(int argc, char **argv)
{
   s7_scheme *s;
   int i;
   s = s7_init();
#if 1
   for (i = 0; i < 2000000; i++)
     s7_eval_c_string(s, "(list 1 2 3)");
#else
   for (i = 0; i < 2000000; i++)
     s7_list_nl(s, 4, s7_make_symbol(s, "list"),	\
	       s7_make_integer(s, 1),		\
	       s7_make_integer(s, 2),		\
	       s7_make_integer(s, 3),		\
	       NULL);
#endif
}

/* gcc -o ex1 ex1.c s7.o -O2 -lm -I. -ldl */
/* 3045 vs 703 callgrind */

A factor of 4!




More information about the Cmdist mailing list