All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

VWR-25610 LLControlGroup::loadFromFile makes unnecessary copies of large LLSD objects

Review Request #280 - Created April 26, 2011 and submitted

Brad Kittenbrink Reviewers
viewer
VWR-25610
None viewer-development
Unnecessary copying was slowing down debugging of STORM-1141.

 
Ship it!
Posted (April 26, 2011, 5:40 p.m.)

   

  
Ship it!
Posted (April 27, 2011, 4:16 a.m.)
The nice thing about this change is that is has to be correct[*] if it still compiles. (And it does, I checked :-)

3 minor considerations:
indra/llxml/llcontrol.cpp (Diff revision 1)
 
 
 
1) Any reason not to do the same for name?
2) Remove space between "const" and "&", so that it's easer to visually distinguish from binary operator &
3) LLSD::map_const_iterator seems to support operator ->, so we could write itr->second instead of (*itr).second .
  1. 1) Premature optimization is the root of all evil.  In all seriousness though, I found that the recursive LLSD copying was causing a significant number of memory allocations.  I didn't notice the name copying in the profiling, so I didn't look at it.  Making this consistent is probably a good idea.
    2) I think this is a bad idea, that would be far less readable imho.
    3) I'd be fine with this change at some point, but I don't think it really matters.
[*] Assuming the data referenced by control_map isn't changed by other threads meanwhile. But I guess that'd also be necessary for copying it correctly, isn't it?
  1. Correct, there are no other threads that can interfere with LLControlGroup::loadFromFile