lean4-htt/src/util/sexpr
Leonardo de Moura 01eb27d4a4 feat(util): "deterministic timeout" option
closes #1134

see #1362

This feature is implemented using a "hearbeat" thread local counter.
We reset the counter whenever we start a new task.
The counter is incremented when:

  1- An object is allocated using small_object_allocator (e.g., VM object)
  2- An object is allocated using memory_pool (e.g., expr, level, rb_tree nodes, list cons-cells, etc)
  3- check_system(...) invocations

We check if the threshold was reached at check_system.
The option --timeout=num can be used to set the limit (in thousands).
The default is unbounded in batch mode.
In server mode, the default is 100000. We can compile the standard library with --timeout=12000

I did not perform many experiments to check how precise this counter is.
I added a new Emacs configuration setting to change the server default.

Here is the wall clock time for different values of --timeout for the
command used on issue #1134

time ../../bin/lean -j 0 --timeout=20000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.070s
user	0m1.032s
sys	0m0.036s

time ../../bin/lean -j 0 --timeout=40000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.777s
user	0m1.676s
sys	0m0.044s

time ../../bin/lean -j 0 --timeout=50000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.985s
user	0m1.920s
sys	0m0.056s

time ../../bin/lean -j 0 --timeout=100000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m3.587s
user	0m3.564s
sys	0m0.020s
2017-02-07 13:56:12 -08:00
..
CMakeLists.txt feat(CMakeLists): add shared library 2015-08-13 11:21:05 -07:00
format.cpp chore(util/sexpr): remove mpz and mpq cases 2017-01-31 09:39:31 +01:00
format.h chore(util/sexpr): remove mpz and mpq cases 2017-01-31 09:39:31 +01:00
init_module.cpp refactor(*): explicit initialization/finalization for serialization 2014-09-22 15:26:41 -07:00
init_module.h refactor(*): start move to explicit initialization/finalization, 2014-09-22 10:41:07 -07:00
option_declarations.cpp feat(util/sexpr/option_declarations): allow options to be registered after initialization 2016-08-19 16:58:30 -07:00
option_declarations.h feat(util/sexpr/option_declarations): allow options to be registered after initialization 2016-08-19 16:58:30 -07:00
options.cpp feat(util): "deterministic timeout" option 2017-02-07 13:56:12 -08:00
options.h feat(util): "deterministic timeout" option 2017-02-07 13:56:12 -08:00
register_module.h
sexpr.cpp chore(util/sexpr): remove mpz and mpq cases 2017-01-31 09:39:31 +01:00
sexpr.h chore(util/sexpr): remove mpz and mpq cases 2017-01-31 09:39:31 +01:00
sexpr_fn.cpp
sexpr_fn.h feat(frontends/lean): improve pretty printing space insertion heuristic 2015-09-30 17:36:32 -07:00