Skip to content

Instantly share code, notes, and snippets.

@andrewbolster
Created August 6, 2012 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewbolster/3275052 to your computer and use it in GitHub Desktop.
Save andrewbolster/3275052 to your computer and use it in GitHub Desktop.
How to make speed
# Array evaluations were taking up 60% of my execution time. This is a simplified version
import logging, numpy
logging.basicConfig(level=logging.INFO)
x=numpy.random.rand(100,100)
logging.debug("This is bloody slow because of this: %s"%x)
# Remember, the array is evaluated BEFORE being passed to logging
#So, to cheat:
debug = False
if debug: logging.debug("This is bloody slow because of this: %s"%x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment