Skip to content

Instantly share code, notes, and snippets.

@clausecker
Created September 15, 2012 18:38
Show Gist options
  • Save clausecker/3729225 to your computer and use it in GitHub Desktop.
Save clausecker/3729225 to your computer and use it in GitHub Desktop.
Counter comparison
/* counter_stdio.c */
#include <stdio.h>
int main() {
int i = 0;
for (;;i++) fwrite(&i,sizeof i,1,stdout);
}
/* counter_write.c */
#include <stdio.h>
int main() {
int i = 0;
int icache[BUFSIZ];
for (;;i++) {
icache[i%BUFSIZ] = i;
if (i%BUFSIZ==BUFSIZ-1) write(1,icache,sizeof icache);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment