You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cprintf seems to be the only way to print colored strings in the command window. Some users report that it's slow. What is its performance impact exactly?
The text was updated successfully, but these errors were encountered:
Just did a quick (& by no means exhaustive) test and it seems to add a second. Below are some timing result for calling disp vs cprintf 200 times; the test code is below it.
etime1 =
0.0025
etime2 =
1.1826
etime3 =
1.1397
N = 200;
tic;
for i = 1:N
disp( 'hi' );
end
etime1 = toc;
tic;
for i = 1:N
cprintf( 'hi\n' );
end
etime2 = toc;
tic;
for i = 1:N
cprintf( '*[1,0,0]', 'hi\n' );
end
etime3 = toc;
etime1
etime2
etime3
Yeah it's slower. If I increase N to 2000, I get the results below. Hopefully someone is doing much more computation than logging so an extra 10 seconds w/ cprintf would not be a bother. Perhaps cprintf can be an option?
cprintf seems to be the only way to print colored strings in the command window. Some users report that it's slow. What is its performance impact exactly?
The text was updated successfully, but these errors were encountered: