If the processing performance requirements are severe, you may be concerned about the processing time of the implemented processing. This time I would like to leave a memorandum on how to measure the processing time in Python and Java.
Measure processing time
# -*- coding: utf-8 -*-
import time
# main
if __name__ == "__main__":
#Start time
startTime = time.time()
#Processing of measurement target
# processing
#End time
endTime = time.time()
#Display of processing time
print(endTime - startTime)
Measure processing time
public class TimeWatchDemo {
public static void main(String[] args) {
//Start time
long startTime = System.nanoTime();
//Processing of measurement target
// processing
//Completion time
long endTime = System.nanoTime();
//Display of processing time
System.out.println(endTime - startTime);
}
}
Recommended Posts