Ask coding questions

← Back to all posts
How to check time and memory for compilation a program?
PremTiwari1 (2)

How to check time and memory for compilation a program

JacobMacLeod (12)

Are you using python? You may be able to use a terminal command, which you can run in python using print(os.popopen('terminalcommand'))
I'm not really sure though :(

SuperUser111 (12)

If you're using Java, you can use the System.currentTimeMillis() function to record the time the program started, and then use the System.currentTimeMillis() function at the end of the program.

By subtracting the new System.currentTimeMillis() by the old System.currentTimeMillis() to determine how long the program took to compile.

SixBeeps (5061) doesn't have this feature (at least I don't think it does) but you're not entirely out of luck. There are plenty of libraries written to compile code at runtime. Just google "lang compile at runtime" and you'll see a few projects have been written for this. All you'd need to do then is compare the time before compilation to after compilation, and maybe get the difference in memory.