Magma has a mechanism for measuring how long it takes to execute a statement or statements.
The time command:
> time STATEMENT
executes the STATEMENT as usual, and also prints the time taken for this. The time is printed as the number of seconds taken by the CPU.
To time several statements, the Cputime function should be used, in the following way:
> t := Cputime(); > STATEMENTS > print Cputime(t);
Cputime with no arguments returns the CPU time since the beginning of the Magma session, and Cputime(t) returns the CPU time since time t (a real number).
> n := 2^109-1; > time print Factorization(n); [<745988807, 1>, <870035986098720987332873, 1>] Time: 5.300[Next] [Prev] [_____] [Left] [Up] [Index] [Root]> m := 2^111-1; > n := 2^113-1; > t := Cputime(); > print Factorization(m); [<7, 1>, <223, 1>, <321679, 1>, <26295457, 1>, <319020217, 1>, <616318177, 1>] > print Factorization(n); [<3391, 1>, <23279, 1>, <65993, 1>, <1868569, 1>, <1066818132868207, 1>] > print Cputime(t); 11.881