Questions tagged [line-profiler]

Use this tag for questions about the Python "line_profiler" package. If you have a question about performance, or how to optimize your code based on "line_profiler" results, please use the more generic "performance" or "optimization" tags instead.

line_profiler is an external package allowing to measure the execution time (both relative and absolute) spent in each line. This can be an important utility to find bottlenecks or hotspots in python functions.

66 questions
0
votes
1 answer

Python - Manually wrapping a method (Specifically, am asking about line-profiler by robert kern)

Wrapping a function is no problem: How do I use line_profiler (from Robert Kern)? from line_profiler import LineProfiler import random def do_stuff(numbers): s = sum(numbers) l = [numbers[i]/43 for i in range(len(numbers))] m =…
MSam
  • 13
  • 4
0
votes
1 answer

kernprof command not found - Ubuntu

I just installed line_profiler using pip on Ubuntu. I closed and reopened the terminal, cd'd into the directory with my file to time, and ran kernprof. Bash is telling me it can't find kernprof. Coincidentally, I just did the exact same procedure…
Vendea
  • 145
  • 1
  • 1
  • 9
0
votes
1 answer

Python line profiler results inconsistent

Why is it that python code runs at drastically different speeds despite being the same code run twice? Code I was doing some profiling for a short Python code: import urllib3 @profile def download(url, file_path): http = urllib3.PoolManager() …
Moon Cheesez
  • 2,489
  • 3
  • 24
  • 38
0
votes
0 answers

kernprof wont profile my code

I'm trying to profile my code and I cannot figure out why kernprof isn't working. I've run examples and they work just fine however my code just hangs. Here is my code: import networkx as nx from itertools import combinations u =…
moku
  • 4,099
  • 5
  • 30
  • 52
-1
votes
1 answer

Can I run line_profiler on python module?

I have a module named my_module with the following structure. . └── my_module ├── main.py └── test.py Here, I use python -m my_module.test, in order to run the test because it uses relative import. Then how can I run line_profiler,…
Sean
  • 489
  • 1
  • 8
  • 29
-2
votes
1 answer

How to analysis python performance and view results as call tree?

I have seen such a program in accident, but I forget the name and can not find it anymore. It works just like line profiler. Well, when I saw it, it's an article comparing it with line profiler. The results are more friendly. They are like main …
iuradz
  • 1,128
  • 1
  • 12
  • 25
1 2 3 4
5