lkml.org 
[lkml]   [2015]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] small update for strlen, strnlen, use less cpu instructions
On Tue, 16 Jun 2015 04:40:55 -0500 Orestes Leal Rodriguez wrote:
> very small update to strlen and strnlen that now use less cpu
> instructions by using a counter to avoid the memory addresses
> substraction to find the length of the string.

Nice. :-)

Performance counter stats for './strnlen-new':

3.602591 task-clock (msec) # 0.836 CPUs utilized
4 context-switches # 0.001 M/sec
2 cpu-migrations # 0.555 K/sec
48 page-faults # 0.013 M/sec
9,607,307 cycles # 2.667 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
23,612,424 instructions # 2.46 insns per cycle
9,121,754 branches # 2531.998 M/sec
5,409 branch-misses # 0.06% of all branches

0.004311477 seconds time elapsed


Performance counter stats for './strnlen-old':

3.181354 task-clock (msec) # 0.930 CPUs utilized
1 context-switches # 0.314 K/sec
1 cpu-migrations # 0.314 K/sec
47 page-faults # 0.015 M/sec
8,558,129 cycles # 2.690 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
23,577,237 instructions # 2.75 insns per cycle
9,114,760 branches # 2865.057 M/sec
4,298 branch-misses # 0.05% of all branches

0.003419085 seconds time elapsed

However, you will need to create a proper patch:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/SubmittingPatches

--
Mihai Donțu


\
 
 \ /
  Last update: 2015-06-16 12:21    [W:0.019 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site