5 ms·
For a start, getc() isn't a simple macro accessing read buffer anymore, but a function which always acquires/releases a lock (even in single-threaded program).
by rini17 7y ago
For a start, getc() isn't a simple macro accessing read buffer anymore, but a function which always acquires/releases a lock (even in single-threaded program). Changing it into getc_unlocked() usually makes big difference.
http://man7.org/linux/man-pages/man3/unlocked_stdio.3.html http://man7.org/linux/man-pages/man3/unlocked_stdio.3.html
- bonzini 7y agoThe linked code uses read(), not getc().