I was looking at the timelimit command in Maple, and wonder about whether it might be improved .
The help-page ?timelimit says that it suspends its checks while within builtin functions. It says that, inside builtins, the time limit is "ignored".
But Maple has a lot of builtins. And significant portions of the work may go on within them. Does this make the timelimit() function not useful, from a practical point of view?
What if timelimit were to make checks whenever garbage collection (gc) ocurred? That's a safe point, no? And gc can happen within some builtins? Or what if time checks were made at the same frequency that interrupt requests were checked? Those can happen within some builtins, at safe points.
Those were my thoughts, until I tried it. The command anames(builtin) shows that rtable() is a builtin. But I have found that timelimit will function within at least some rtable() calls.
> with(LinearAlgebra): > A := RandomMatrix(1000,'density'=0.1, > 'outputoptions'=['storage'='sparse', > 'datatype'=float[8]]): > timelimit(10, > rtable(1..N,1..N,A,'storage'='rectangular','datatype'=float[8]) > ): Error, time expired
Does anyone have an idea what the complete and true story is, with respect to builtins? Also, I notice that it didn't say "Error, (in rtable).." like the help-page indicates. Is that an effect of it timing-out within a builtin?
What about the error message that timelimit returns? Could it not be better if it returned something like this?
Error, (in f) time limit expired, and exceeded by 2 sec
acer
3 hours 32 min ago
4 hours 48 min ago
1 hour 42 min ago
7 hours 37 min ago
7 hours 43 min ago
10 hours 13 min ago
10 hours 21 min ago
12 hours 5 min ago
18 hours 8 min ago
1 day 22 min ago