In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "python how to use cProfile for performance analysis of back test", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "python how to use cProfile for back test performance analysis"!
Installation
There is no need to install, python usually comes with it.
Use
There are several ways to use it, and I output it directly. Is to put the test back code in a method, such as runBackTesting (). Then the main method runs according to the following code, which is sorted by cumulative time. Hint, it is best to comment out the Matplot image output, because the interaction time is also statistical.
If _ _ name__ = ='_ main__': cProfile.run ("runBackTesting ()", sort= "cumulative") performance analysis results
As shown in the following figure
The first line is the total number of function calls and the total elapsed time
The description of the following column
Ncalls: indicates the number of times a function is called
Tottime: indicates the total running time of the specified function, excluding the running time of the calling subfunction in the function
Percall: (the first percall) equals tottime/ncalls
Cumtime: indicates the time that the call to the function and all its subfunctions runs, that is, the time from the start of the call to the return of the function
Percall: (the second percall) is the average time for a function to run once, which is equal to cumtime/ncalls
Filename:lineno (function): the specific information of each function call; it is preceded by the file name, the number of lines, followed by the method name, and some methods, such as max,min, do not have a file name.
Thank you for your reading, the above is the content of "python how to use cProfile for performance analysis of back test". After the study of this article, I believe you have a deeper understanding of how python uses cProfile for performance analysis of back test, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.