25449

How to measure the time of a Maya script?

Question:

I have several methods implemented in MEL, and I would like to measure its performance. Is there any way to measure execution time of a fragment of code? Something equivalent to "getCurrentTime" in other languages.

Answer1:

the timerX() command will give you seconds since Maya was started, so you can grab that and do the math:

float $start = timerX();

Answer2:

Timer

// Example 1: Simple timing // $startTime = `timerX`; // code that is being timed $totalTime = `timerX -startTime $startTime`; print ("Total Time: "+$totalTime+"\n");

Recommend

  • How to measure the time of a Maya script?
  • Sending an Email after countdown expires
  • SQL to select records for a specific date given created time and modified time
  • Does Maya Mel have a good API to a IDE? [closed]
  • Why is image stored different than the one imshowed?
  • Store a numpy.ndarray as an image, and then save the pixel values
  • How to check for phone network on Android devices
  • Object has null values when subclass attempts to use it. Why?
  • Maven archetype generate with custom properties
  • Running a Service from ASyncTask or Thread?
  • C# Application Relative Paths
  • Back press fragments issue in android
  • Flex/AS3 very strange simple Number operation issue
  • Why can't I use non-integral types with switch [duplicate]
  • Converter from SAT to 3-SAT
  • Excel VBA How to populate a multi-dimensional (3d) array with values from multiple excel ranges?
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • Linq Objects Group By & Sum
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Optimizing database types to compact database (SQLite)
  • How do I fake an specific browser client when using Java's Net library?
  • Apache 2.4 - remove | delete | uninstall
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Buffer size for converting unsigned long to string
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • reshape alternating columns in less time and using less memory
  • java string with new operator and a literal