Profiling Django

Try the Django Debug Toolbar. It will show you what queries are executed on each page and how much time they take. It’s a really useful, powerful and easy to use tool. Also, read recommendations about Django performance in Database access optimization from the documentation. And Django performance tips by Jacob Kaplan-Moss.

Benchmarking small code samples in C#, can this implementation be improved?

Here is the modified function: as recommended by the community, feel free to amend this its a community wiki. static double Profile(string description, int iterations, Action func) { //Run at highest priority to minimize fluctuations caused by other processes/threads Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; Thread.CurrentThread.Priority = ThreadPriority.Highest; // warm up func(); var watch = new Stopwatch(); // … Read more

Reducing Django Memory Usage. Low hanging fruit?

Make sure you are not keeping global references to data. That prevents the python garbage collector from releasing the memory. Don’t use mod_python. It loads an interpreter inside apache. If you need to use apache, use mod_wsgi instead. It is not tricky to switch. It is very easy. mod_wsgi is way easier to configure for … Read more

How to measure time taken between lines of code in python?

If you want to measure CPU time, can use time.process_time() for Python 3.3 and above: import time start = time.process_time() # your code here print(time.process_time() – start) First call turns the timer on, and second call tells you how many seconds have elapsed. There is also a function time.clock(), but it is deprecated since Python … Read more

Beyond Stack Sampling: C++ Profilers

First: Time sampling profilers are more robust than CPU sampling profilers. I’m not extremely familiar with Windows development tools so I can’t say which ones are which. Most profilers are CPU sampling. A CPU sampling profiler grabs a stack trace every N instructions. This technique will reveal portions of your code that are CPU bound. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)