I have a program that outputs data from an FPGA. Since changing EXTREMELY data quickly, I try to increase the speed of the program. Now I am printing data like this
for (int i = 0; i < 100; i++) { printf("data: %d\n",getData(i)); }
I found that using one printf significantly increases speed
printf("data: %d \n data: %d \n data: %d \n",getData(1),getData(2),getData(3));
However, as you can see, this is very dirty, and I cannot use the for loop. At first I tried to combine the lines using sprintf and then print everything at once, but this is as slow as the first method. Any suggestions?
Edit: First I print the file because I realized that console scrolling would be a problem. But its still too slow. I am debugging a memory controller for an external FPGA, so the closer to real speed, the better.
source share