特定のコードでボトルネックをどのように処理できるかを知りたいです。
%% Points is an Nx3 matrix having the coordinates of N points where N ~ 10^6
Z = points(:,3)
listZ = (Z >= a & Z < b); % Bottleneck
np = sum(listZ); % For later usage
slice = points(listZ,:);
現在N ~ 10^6
、np ~ 1000
とnumber of calls to this part of code = 1000
のボトルネック ステートメントには合計で約 10 秒かかっています。これは、コードの残りの部分に比べてかなりの時間です。
@EitanT によって要求されたインデックス作成ステートメントのみのサンプル コードのスクリーンショット