필터 지우기
필터 지우기

JIT vs vectorization

조회 수: 2 (최근 30일)
Ariel Balter
Ariel Balter 2011년 3월 2일
Is there a reference for general rules for when vectorization is faster than the JIT?
I actually prefer to use for loops. I believe it makes my code more transparent. Months later it is much easier to figure out what a loop is doing than an intricate vectorized statement.
Is JIT as fast as vectorization for loops (when the code in the loop is acceptable for the JIT)?
Thanks, Ariel

답변 (1개)

Matt Fig
Matt Fig 2011년 3월 2일
JIT is just as fast as vectorization,... sometimes.
There is no published guide for using JIT because TMW doesn't want you to write code specifically for the JIT accelerator.
The two best tips that I know of for making loops as quick as possible:
  1. Pre-allocate arrays.
  2. Move repeated code to outer loops or completely outside if possible.
For plenty of examples, search CSSM.
  댓글 수: 2
Ariel Balter
Ariel Balter 2011년 3월 2일
Thanks. That's pretty much what I try to do. What is CSSM?
Matt Fig
Matt Fig 2011년 3월 2일
http://www.mathworks.com/matlabcentral/newsreader/

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by