RE: [PATCH][next] EDAC, pnd2: Make read-only const array intlv static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Colin King (gmail) <colin.i.king@xxxxxxxxx>
> [...]

> >> -	const int intlv[] = { 10, 11, 12, 12 };
> >> +	static const int intlv[] = { 10, 11, 12, 12 };
> >>
> >
> > I didn't see the why and the benefits of these changes.
> > Could you elaborate more?
> 
> The non-const construct will generate code to put the array on the stack and

Typo? 
s/non-const/non-static/

> this occurs on each call, so there is a small amount of extra object code
> overhead to do this at run time. Making it static will put the data into a data
> section so there is run-time penalty. So this change potentially shrinks the
> object code and run time overhead a very small amount.
> 

Thanks! 

As these are not in hot paths, there should be no measurable performance difference. 

But, I do see that the text size is reduced by 12 bytes [1] after these changes.
Could you add a short description of this benefit in the commit message? 
Other than that,

    Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>

[1] $ size pnd2_edac.o.*

   text    data     bss     dec     hex filename
  15632     264    1384   17280    4380 pnd2_edac.o.new
  15644     264    1384   17292    438c pnd2_edac.o.old

- Qiuxu




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux