Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 747981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:16:04+00:00 2026-05-14T14:16:04+00:00

Possible Duplicates: Accurate timing of functions in python accurately measure time python function takes

  • 0

Possible Duplicates:
Accurate timing of functions in python
accurately measure time python function takes

How can i mesure and compare the running times of my algorithms written in python .Also point me to a nice algorithms site/forum like stackoverflow if you can.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:16:04+00:00Added an answer on May 14, 2026 at 2:16 pm

    I am not 100% sure what is meant by “running times of my algorithms written in python”, so I thought I might try to offer a broader look at some of the potential answers.

    • Algorithms don’t have running times; implementations can be timed, but an algorithm is an abstract approach to doing something. The most common and often the most valuable part of optimizing a program is analyzing the algorithm, usually using asymptotic analysis and computing the big O complexity in time, space, disk use and so forth.

      A computer cannot really do this step for you. This requires doing the math to figure out how something works. Optimizing this side of things is the main component to having scalable performance.

    • You can time your specific implementation. The nicest way to do this in Python is to use timeit. The way it seems most to want to be used is to make a module with a function encapsulating what you want to call and call it from the command line with python -m timeit ....

      Using timeit to compare multiple snippets when doing microoptimization, but often isn’t the correct tool you want for comparing two different algorithms. It is common that what you want is asymptotic analysis, but it’s possible you want more complicated types of analysis.

    • You have to know what to time. Most snippets aren’t worth improving. You need to make changes where they actually count, especially when you’re doing micro-optimisation and not improving the asymptotic complexity of your algorithm.

      If you quadruple the speed of a function in which your code spends 1% of the time, that’s not a real speedup. If you make a 20% speed increase on a function in which your program spends 50% of the time, you have a real gain.

      To determine the time spent by a real Python program, use the stdlib profiling utilities. This will tell you where in an example program your code is spending its time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer OK to begin with that is the wrong template if… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer The best way to do it is to write a… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer This seems to be a typical instance of conflating coincidence… May 16, 2026 at 11:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Possible Duplicates: [.NET] How do I disable a system device? Win32 API function to
Possible Duplicates: C++0X when? When will C++0x be finished? When will C++0x be released?
Possible Duplicates: Why is lock(this) {...} bad? In C# it is common to use
Possible Duplicates: What is the best approach for a Java developer to learn C++
Possible Duplicates: Formatting of if Statements Is there a best coding style for identations
Possible Duplicates: Is String.Format as efficient as StringBuilder C# String output: format or concat?
Possible Duplicates: Valid use of goto for error management in C? Examples of good
Possible Duplicates: Why use ++i instead of i++ in cases where the value is
Possible Duplicates: How do I convert an InputStream to a String in Java? In
Possible Duplicates: Why is it bad to use goto? GOTO still considered harmful? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.