Skip to Content
고성능 파이썬(2판)
book

고성능 파이썬(2판)

by 오현석, 미샤 고렐릭, 이안 오스발트
May 2021
Beginner to intermediate
528 pages
11h 27m
Korean
Hanbit Media, Inc.
Content preview from 고성능 파이썬(2판)
157
6
행렬과 벡터 계산
가능하다면 이미 할당된 공간을 재사용하는 쪽이 성능 향상에 도움이 된다. 하지만 주의할 점
이 있다. 이렇게 해서 속도를 상당히 개선하더라도 그 변경이 코드 기반을 망치지 않고 여전히
정상적으로 동작하는지를 항상 프로파일해야 한다.
예제
6-7
메모리 할당을 줄인 파이썬 확산 방정식 코드의 프로파일링 결과
$
kernprof -lv diffusion_python_memory.py
Wrote profile results to diffusion_python_memory.py.lprof
Timer unit: 1e-06 s
Total time: 541.138 s
File: diffusion_python_memory.py
Function: evolve at line 12
Line # Hits Time Per Hit % Time Line Contents
==============================================================
12 @profile
13
def
evolve(grid, dt, out, D=1.0):
14 500 503.0 1.0 0.0 xmax, ymax = grid_shape
15 320500 131498.0 0.4 0.0
for
i
in
range(xmax):
16 205120000 81105090.0 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

이펙티브 타입스크립트

이펙티브 타입스크립트

Dan Vanderkam
엑셀이 편해지는 파이썬

엑셀이 편해지는 파이썬

펠릭스 춤슈타인
핸즈온 비지도 학습

핸즈온 비지도 학습

강재원, 권재철, 안쿠르 A. 파텔

Publisher Resources

ISBN: 9791162244210