linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] util: Optimize path_encode
Date: Tue, 21 Oct 2008 21:41:02 +0000	[thread overview]
Message-ID: <48FE4C6E.2050607@tuffmail.co.uk> (raw)
In-Reply-To: <48FDAB29.9090401@tuffmail.co.uk>

Kay Sievers wrote:
> On Tue, Oct 21, 2008 at 12:12, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>   
>> strncpy() shows up in profiling.
>> Since we already know the length, use memcpy() instead.
>>
>> Measured 2% _user_ cpu time reduction on EeePC coldplug
>>     
>
> Applied.
>
> Thanks,
> Kay
>   

Ah... just realised it wasn't the normal C string length inefficiency. 
The problem was strncpy() doesn't stop after writing the terminating
NUL; by definition it goes on to zero the entire buffer.

I spy another use of strncpy in udev_device_add_property_from_string(),
which is responsible for another ~1% user cpu time...

BTW I'm still polishing threaded udevd in my spare time.  It has 4
TODOs; I will post it soon anyway, but I need to write a few explanatory
words first.  I have coarse-grained patch descriptions, but there are a
couple of obvious questions I would like to pre-answer :).

      parent reply	other threads:[~2008-10-21 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 10:12 [PATCH] util: Optimize path_encode Alan Jenkins
2008-10-21 11:12 ` Kay Sievers
2008-10-21 21:41 ` Alan Jenkins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48FE4C6E.2050607@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).