Discover python performance profiling, include the articles, news, trends, analysis and practical advice about python performance profiling on alibabacloud.com
This article mainly introduces the simple performance test results of common python web frameworks (including django, flask, bottle, tornado ), for more information about the performance of django, flask, bottle, and tornado frameworks. The performance of django is completely speechless.
Django, flask, and bottle are
Build a python high-performance framework gevent Development Environment on CentOS 6.31. Upgrade python 2.6 to python 2.7.For business needs, upgrade python from 2.6.6 to 2.7.10 before installation. Refer to blog:Http://blog.csdn.net/tao_627/article/details/46928899
Install
configuration file will look more uniform than opening in the script4. Browser viewChrome refreshes the GHIPTE Web page to seeGhipte, servers, ec2-54-201-82-69, weblog (custom), HTTP, the following monitoring graphs appearWe can generate 200 status codes using Ab-c 100-n http://localhost/Use the Refresh Ghipte browser page to generate a 304 status code650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5C/0B/wKioL1UaHCijRVkoAAMpNTmsVaU913.jpg "title=" Manual httpcode.png "width=" 650 "he
the child interpreter resides.4) in the sub-process, the binary data is deserialized with pickle, which is reverted to a Python object.5) Introduce a Python module that contains the GCD function.6) Each sub-process computes its input data in parallel.7) Serialize the result of the operation and turn it into bytes.8) Copy these bytes through the socket into the main process.9) The main process performs a de
Tags: python mysqldb dbutil sqlobject pooleddbFirst introduce the following mysqldb, Dbutil, Sqlobject:(1) MySQLdb is the interface for Python to connect MySQL database, it implements the Python database API specification V2.0, based on the MySQL C API. In addition to MySQLdb, Python can also be oursql, pymysql, Myconn
Today, the Python dictionary has been specifically tested for performance results in comparison with various methods.The test code is as follows:1 defdict_traverse ():2 fromTimeImportClock3My_dict = {'name':'Jim',' Age':' -','Height':'180cm','Weight':'60kg'}4 5T_start =clock ()6 forKeyinchMy_dict:#worst-performing notation. No optimization7 Print 'Type01.01:%s---%s'%(Key, My_dict[key])8T1
Locating program Performance BottlenecksThe prerequisite for code optimization is to understand where the performance bottleneck is, where the main time of the program is consumed, and for more complex code to be located with tools, Python has built-in rich performance analysis tools such as Profile,cprofile and hotsho
times-fold difference in performance. Remember that the string is very large, do not use s=s+a[i] this way, because the constant creation of memory space to add, not only the program is very card, greatly consumes the resources, but also very slow.
____________________________________________________________
In Python:
Import time# First Way, appenda=[]t=time.time () for I in Range (1000000): a.a
in the processor at any given time.The Gil solves the problem:To take advantage of multicore, Python supports multi-threading, but there are data integrity and state synchronization issues between threads, while Gil solves data integrity and state synchronization issues between multithreading (loads locks on lines running on the interpreter, ensuring that only one thread is running in the interpreter at a time).Effects of Gil:A loads lock on a thread
Python 3.6 Performance Testing Framework Locust installation and use, pythonlocust
Background
Build and use of Python3.6 Performance Testing Framework Locust
Basic
Python version: python3.6
Development Tool: pycharm
Installation and configuration of Locust
Click "File"> "setting"
Click "setting" to enter the settings
Share the simple Performance Test Results of common python web frameworks (including django, flask, bottle, tornado) and djangoflask
Tested the simplest performance of django, flask, bottle, and tornado frameworks. The performance of django is completely speechless.
Django, flask, and bottle are all started using gunic
resource exhaustion problem. Python's socket processing is not suitable for dealing with these types of situations, specifically, we found that in our own Python code, each action has made multiple system calls and context switches, which adds enormous overhead to the system. Improved performance: Mix python with C After combing the code, I chose to port the mos
Google's own search solution, Linux and Mac should be able to run directly.Using cTYPES to invoke C-language functionsOr the above example, we require a 2 number of the and. So you can write that on Windowsint Add (intint num2) { return num1 + num2;}Then it compiles the file into a dynamic-link library, which requires the CL commandThe CL command requires Visual Studio to be installed, and if it is already installed, use this method to configure the environment variable HTTP://HI.BAIDU.COM/
Python to optimize NumPy package performance tutorial, pythonnumpy
NumPy is the foundation of many scientific software packages in Python. It provides a special data type ndarray, Which is optimized in vector computing. This object is the core of most algorithms in scientific numerical computing.
Compared with native Python
The original love coding, will program the nuclear power engineer. Personal blog Address: zhihu.com/people/zhong-yun-75-63Learn some tricks to maximize the performance of Python programs and avoid unnecessary waste of resources.1. Using Local variablesTry to use local variables instead of global variables: Ease of maintenance, improved performance, and memory sav
resides in system memory。 Internal commands are located in the bash source code, which executes faster than external commands becauseParse Internal command shell does not need to create child process, such as Exit,cd,pwd,echo,history.external Commandis a utility application in a Linux system, because the utility is usually powerful and contains a large number of programs,when the system is loaded, it is not loaded into memory with the system, but is transferred into memory when needed。 Entities
This article mainly introduces how to modify the main loop in Python pyxmpp2 to improve its performance. pyxmpp2 is a common tool for Python to use the XMPP protocol. For more information, see
Introduction
Previously, the default mainloop of pyxmpp2 used by clubot is a main loop of poll. However, after clubot went online, the resource usage was very high. using
Get the latest version of the program here:Https://github.com/giampaolo/psutilDownload:wget https://pypi.python.org/packages/source/p/psutil/psutil-2.1.3.tar.gzInstalling Python-develYum-y Install Python-develInstall Psutil:TAR-ZXF psutil-2.1.3.tar.gzcd psutil-2.1.3python setup.py--help# View installation options python setup.py install# Direct installation-----C
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.