lkml.org 
[lkml]   [2023]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/1] usb: gadget: configfs: Use memcpy_and_pad()
On Thu, Feb 02, 2023 at 10:21:09PM +0000, David Laight wrote:
> From: Andy Shevchenko
> > Sent: 02 February 2023 15:18
> >
> > Instead of zeroing some memory and then copying data in part or all of it,
> > use memcpy_and_pad().
> > This avoids writing some memory twice and should save a few cycles.
>
> Maybe, maybe not.
> It rather depends on the lengths involved (the code doesn't seem to be in the
> main tree).
>
> The cost of the conditionals and the misaligned length/start for the
> memset() could easily overwhelm any apparent saving.
>
> A memset() of a constant whole number of words is going to be significantly
> faster than the partial one.


Then you can put some (little I suppose) efforts in optimizing memcpy_and_pad()
once for all, no?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2023-03-27 00:08    [W:0.041 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site