Search code examples
rascal

How to get current time in milliseconds in Rascal


I want to debug a slow function in Rascal, to find out why it is slow. To do this, I want to save the system time in milliseconds at certain locations so I can measure the time taken by certain parts of the code.

I have looked at the DateTime module (http://tutor.rascal-mpl.org/Rascal/Expressions/Values/DateTime/DateTime.html), but it does not seem easy to compute time differences this way. Is there any better way?


Solution

  • There is a buildin profiler in rascal, that does function and statement level profiling. You can enable it with :set profiling true in the repl.

    If you want to do benchmarking, take a look at util:;Benchmark