On 1 July 2013 10:01, Karel Zak <kzak@xxxxxxxxxx> wrote: > On Sun, Jun 16, 2013 at 07:53:56PM +0100, Sami Kerola wrote: >> This makes common cases 35-50% quicker. > > What about portability and code readability? > > It would be nice to have include/unlocked-io.h and add > AC_CHECK_DECLS_ONCE() for all *_unlocked functions. > > See gnulib/lib/unlocked-io.h > gnulib/m4/unlocked-io.m4 > > .. then you can control all the behaviour by "#include unlocked-io.h" > rather than change all the code in the util(s). Maybe we can use the > functions in more utils where we intensively print something (e.g. > dmesg). > > I guess we don't want separate m4 file for this stuff. Good idea. When I tested the putchar_unlocked() was more or less equally quick with putchar(), but I chose to squeeze even the theoretical speed out of the printing. For now it might be best, from portability point of view, to 's/_unlocked//' and add later some clever build time automation which will pick the most suitable function. -- Sami Kerola http://www.iki.fi/kerolasa/ -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html