Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339379

Re: [PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient

From Alexander Stein <alexander.stein@systec-electronic.com>
Newsgroups linux.kernel
Subject Re: [PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient
Date 2016-02-22 12:20 +0100
Message-ID <r4WH1-4WG-47@gated-at.bofh.it> (permalink)
References <r4o2B-4bH-7@gated-at.bofh.it> <r4SDn-1Lo-1@gated-at.bofh.it> <r4VKV-47A-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Monday 22 February 2016 10:16:20, Colin Ian King wrote:
> On 22/02/16 06:51, Alexander Stein wrote:
> > On Saturday 20 February 2016 22:10:27, Colin King wrote:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> passing rtl_stats by value is inefficient; the structure is over 300
> >> bytes in size and generally just one field (packet_report_type)
> >> is being accessed, so the pass by value is a relatively large overhead.
> >> This change just affects just the rx_command_packet calls.
> > 
> > Why not using a const pointer?
> 
> const struct rtl_stats *const status?

I think "const structl rtl_stats* status" is enough, no need to make that pointer const itself. Dunno if that would make any difference for compilers in that case.
The idea is that you cannot change the passed struct, same as before because of copy by value.

Best regards,
Alexander

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient Colin King <colin.king@canonical.com> - 2016-02-20 23:20 +0100
  Re: [PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient Alexander Stein <alexander.stein@systec-electronic.com> - 2016-02-22 08:00 +0100
    Re: [PATCH] rtlwifi: pass struct rtl_stats by reference as it is more  efficient Colin Ian King <colin.king@canonical.com> - 2016-02-22 11:20 +0100
      Re: [PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient Alexander Stein <alexander.stein@systec-electronic.com> - 2016-02-22 12:20 +0100

csiph-web