Name: Anonymous 2011-01-06 12:33
Why is glibc's fwrite_unlocked faster than the write syscall?
int
_IO_puts (str)
const char *str;
{
int result = (-1);
size_t len = strlen (str);
_IO_acquire_lock (((_IO_FILE*)(&_IO_2_1_stdout_)));
if (((((_IO_FILE*)(&_IO_2_1_stdout_)))->_vtable_offset != 0
|| _IO_fwide (((_IO_FILE*)(&_IO_2_1_stdout_)), -1) == -1)
&& ((*(struct _IO_jump_t **) ((void *) &((struct _IO_FILE_plus *) (((_IO_FILE*)(&_IO_2_1_stdout_))))->vtable + (((_IO_FILE*)(&_IO_2_1_stdout_)))->_vtable_offset))->__xsputn) (((_IO_FILE*)(&_IO_2_1_stdout_)), str, len) == len
&& (__builtin_expect (((((_IO_FILE*)(&_IO_2_1_stdout_)))->_IO_write_ptr >= (((_IO_FILE*)(&_IO_2_1_stdout_)))->_IO_write_end), 0) ? __overflow (((_IO_FILE*)(&_IO_2_1_stdout_)), (unsigned char) ('\n')) : (unsigned char) (*(((_IO_FILE*)(&_IO_2_1_stdout_)))->_IO_write_ptr++ = ('\n'))) != (-1))
result = (((2147483647)<(len + 1))?(2147483647):(len + 1));
_IO_release_lock (((_IO_FILE*)(&_IO_2_1_stdout_)));
return result;
}stdout file and I'm happy.