Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Return the time taken and the memory used by an operation
| ResourceFunction["TimeMemoryUsed"][expr] evaluates expr, returning a list of the absolute number of seconds in real time that have elapsed, the maximum number of bytes used and the result. | 
Find the time taken and memory used of calculating 54:
| In[1]:= | ![ResourceFunction["TimeMemoryUsed"][5^4]](https://www.wolframcloud.com/obj/resourcesystem/images/43a/43a25b13-74ee-4ab2-a7e2-aec17d3770c1/530ff66499f14d77.png) | 
| Out[1]= |  | 
TimeMemoryUsed combines AbsoluteTiming and MaxMemoryUsed:
| In[3]:= | ![AbsoluteTiming[Plot[Sin[x], {x, 0, 2 Pi}]]](https://www.wolframcloud.com/obj/resourcesystem/images/43a/43a25b13-74ee-4ab2-a7e2-aec17d3770c1/7756415fabae3293.png) | 
| Out[3]= |  | 
Check MaxMemoryUsed:
| In[4]:= | ![MaxMemoryUsed[Plot[Sin[x], {x, 0, 2 Pi}]]](https://www.wolframcloud.com/obj/resourcesystem/images/43a/43a25b13-74ee-4ab2-a7e2-aec17d3770c1/48d8c8bfa0f6b199.png) | 
| Out[4]= |  | 
Combine both of them:
| In[5]:= | ![ResourceFunction["TimeMemoryUsed"][Plot[Sin[x], {x, 0, 2 Pi}]]](https://www.wolframcloud.com/obj/resourcesystem/images/43a/43a25b13-74ee-4ab2-a7e2-aec17d3770c1/14d4ba879aec29f4.png) | 
| Out[5]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License