Greg Zaverucha on Wed, 11 Apr 2007 18:41:20 +0200

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

Timing a function


In a Pari script, I would like to record the time taken by a user defined function and write it to a file.

For example, if I could use the "##" metacommand in a script,

for(i = 1, 1000,
	time = ##;
	write("times.log", i, "  ", time);

In other programming languages I've done things like

for( i = 1, 1000,
	start = gettime();
	end = gettime();
	write("times.log", i, " ", end - start);

I would like to plot the time required by myfunction() for varying inputs.
Does anyone have any suggestions on how I can do this with Pari ?