[Next] [Prev] [_____] [Left] [Up] [Index] [Root]
Timing
Timing
Cputime() : -> FldReElt
Return the CPU time (as a real number of default precision)
used since the beginning of a Magma session.
Cputime(t) : FldReElt -> FldReElt
Return the CPU time (as a real number of default precision)
used since time t (as a real number). Time starts at 0.0 at the beginning
of a Magma session.
time statement
Executes the statement and prints the time taken.
Example State_Time (H1E17)
The time command can be used to time a single statement.
> n := 2^109-1;
> time print Factorization(n);
[<745988807, 1>, <870035986098720987332873, 1>]
Time: 0.149
Alternatively, we can extract the current time t and use Cputime.
This method can be used to time the execution of several statements.
> 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);
0.121
[Next] [Prev] [_____] [Left] [Up] [Index] [Root]