Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fanhaipeng0403/2911d26f8cb9c5cf72e5a0dcfda23565 to your computer and use it in GitHub Desktop.
Save fanhaipeng0403/2911d26f8cb9c5cf72e5a0dcfda23565 to your computer and use it in GitHub Desktop.
测代码运行时间
def profile(func):
def wrapper(*args, **kwargs):
import time
start = time.time()
func(*args, **kwargs)
end = time.time()
print(end - start)
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment