Skip to Main Content
高效能PYTHON程式設計
book

高效能PYTHON程式設計

by Micha Gorelick, Ian Ozsvald
August 2015
Intermediate to advanced content levelIntermediate to advanced
384 pages
7h 42m
Chinese
GoTop Information, Inc.
Content preview from 高效能PYTHON程式設計
矩陣與向量計算
|
125
比較範例 6-15 6-10 的效能數據,可以看到,移除不必要的配置讓程式碼提升效能
29%,部分是因為減少快取未命中(cache miss)的數量,但主要是來自缺頁異常(page
fault)的削減。
範例
6-15 
搭配就地記憶體操作的
numpy
版本的效能數據
$ perf stat -e cycles,stalled-cycles-frontend,stalled-cycles-backend,instructions,\
cache-references,cache-misses,branches,branch-misses,task-clock,faults,\
minor-faults,cs,migrations -r 3 python diffusion_numpy_memory.py
Performance counter stats for 'python diffusion_numpy_memory.py' (3 runs):
7,864,072,570 cycles # 3.330 GHz
3,055,151,931 stalled-cycles-frontend # 38.85% frontend cycles idle
1,368,235,506 stalled-cycles-backend # 17.40% backend cycles idle
13,257,488,848 instructions # 1.69 insns ...
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

流畅的Python

流畅的Python

Luciano Ramalho
手把手教会你linux

手把手教会你linux

桑德.范.乌格特

Publisher Resources

ISBN: 9789863477105