Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#2023 closed defect (wontfix)

[PATCH] Const arguments

Reported by: tuan kuranes Owned by: tuan kuranes
Priority: Nice to Have Milestone:
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by tuan kuranes)

  • Passing larger than 4-byte values by reference to avoid copy-on-move and temporary objects. ("PVS studio" can pinpoint/list all those automatically)
  • const size_t* const is but a way to point for aliasing and therefore "restrict" optimisations and use. (themself leading to potential openmp "optimisations spot")
  • "int getStuff(const size_t arg)" is more developper safeguard and code documentation than real perf. (preventing people using args as local vars and easing code reading, by pointing possible optimisation when code evolves)
  • inlines are added and tested using profiling results (with very sleepy profiler).

Attachments (1)

const.patch (14.5 KB ) - added by tuan kuranes 10 years ago.

Download all attachments as: .zip

Change History (9)

by tuan kuranes, 10 years ago

Attachment: const.patch added


comment:1 by tuan kuranes, 10 years ago

Description: modified (diff)
Summary: Const arguments[PATCH] Const arguments

comment:2 by Kieran P, 10 years ago

Milestone: BacklogAlpha 15

comment:3 by Kieran P, 10 years ago

Milestone: Alpha 15Alpha 14

comment:4 by Kieran P, 10 years ago

Keywords: patch review added; temporary copies memory removed
Priority: Should HaveNice to Have

comment:5 by historic_bruno, 9 years ago

Owner: set to tuan kuranes

comment:6 by Kieran P, 9 years ago

Milestone: Alpha 14Alpha 15

comment:7 by Jorma Rebane, 9 years ago

Keywords: review removed
Milestone: Alpha 15Backlog
Resolution: wontfix
Status: newclosed

This patch unfortunately doesn't really add any value besides littering the code with unnecessary const declarations.

I can understand "const std::string& ref = something->GetString();", but "const int var = 0;" everywhere doesn't really change anything.

comment:8 by leper, 9 years ago

Milestone: Backlog
Note: See TracTickets for help on using tickets.