lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 24 Mar 2012 08:52:46 -0400
From:	Ulrich Drepper <drepper@...il.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: seq_put_decimal_* optimization

If we want to squeeze out the last drop of slack from the /proc text
generation, shouldn't we then avoid code like

+       seq_put_decimal_ull(m, ' ', 0);

which is worse than what was there before? I realize that the code
actually becomes more readable like this.  So how about automatically
optimizing the code by adding something like the following to
seq_file.h:

#define seq_put_decimal_ull(m, delimiter, num) \
  (__builtin_constant_p(num) && \
   __builtin_constant_p(delimiter) && (delimiter) == ' ' \
   ? seq_write(m, " " #num, sizeof(" " #num) - 1) \
   : seq_put_decimal_ull(m, delimiter, num))

Completely untested and it is a minimal change.  It could be written
using an inline function and probably made more general that way
(e.g., handle more delimiters).  But this code should handle the case
that exist today and lead to a (very small) improvement without any
real costs to maintenance.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ