Python Forum
Looking for clarification related to performance
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking for clarification related to performance
#4
I am being sincere. I think it is good advice. Write code to be correct and easy to maintain. If there are performance issues, fix those when they occur. Often this will involve not writing code in Python at all, but instead using Python packages like numpy or pandas that are highly optimized and do much of their work in linked libraries. You are not going to see big changes in performance using a comprehension or map instead of a loop. They are good tools, but they don't turn Python into C. At least that is not my experience.

I use comprehensions and map and other functools because I can write a lot of function in a few lines of code. Potential performance benefits don't cross my mind. I often find a nice comprehension easier to read than a stretched out for loop.

As always, the best way to speed up code is run less code. Optimize the algorithm to get real speed gains.
ndc85430, ibreeden, Larz60+ like this post
Reply


Messages In This Thread
RE: Looking for clarification related to performance - by deanhystad - Apr-03-2022, 02:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can I get some clarification on importing functions from external files. wh33t 3 990 Feb-25-2023, 08:07 PM
Last Post: deanhystad
  Read Tensorflow Documentation - Clarification IoannisDem 0 1,210 Aug-20-2021, 10:36 AM
Last Post: IoannisDem
  *args implementation and clarification about tuple status amjass12 10 4,230 Jul-07-2021, 10:29 AM
Last Post: amjass12
  Although this is a talib related Q it's mostly related to python module installing.. Evalias123 4 5,878 Jan-10-2021, 11:39 PM
Last Post: Evalias123
  Just need some clarification Tonje 3 2,152 Oct-01-2020, 03:52 PM
Last Post: deanhystad
  Global Variables - Some Points Needing Clarification. adt 4 3,048 Nov-30-2019, 01:23 PM
Last Post: adt
  performance kerzol81 1 1,968 Oct-07-2019, 10:19 AM
Last Post: buran
  Clarification Hammuel 2 2,959 Oct-30-2017, 12:22 PM
Last Post: Hammuel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020