G'day, I also had the problem of increasing time between trials and I found the issue by logging times at different points in the protocol.
for currentTrial = 1:1000
times(currentTrial,1) = now;
% the thing you're suspicious about
times(currentTrial,2) = now;
% that other thing you're suspicious about
times(currentTrial,3) = now;
end
At the end of the protocol save [i]times and then you can plot the difference between the times across trials.
Using this I found that it was my poorly written custom outcome plot that was causing the lag.
I hope this helps.