<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Our platforms are all specified with 512MB of ram, so I don’t have any experience with running out of memory on the platforms we use (barring serious memory leaks). 
 It would be interesting if you guys had some anti-patterns that you’ve found to be problems, so we can see if we can codify those into the coding standard rules.  I know that we regularly (ab)use the fact that we have a lot of RAM to make the coding easier
 (reading an entire config file into memory for example) .<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Some of the items in boost are designed to help with memory usage.  Using flat_map over std::map (when used properly) will save memory.  Pooled allocators can
 help with memory fragmentation issues for things that allocate and deallocate lots of objects in c++.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">In general, I don’t find my teams usage of boost to increase memory usage significantly, but it’s something to be considered.  Memory usage tracking might be
 a good thing for a metric test in the future to make sure we aren’t unnecessarily increasing the memory load.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-Ed<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Nancy Yuen [mailto:yuenn@google.com]
<br>
<b>Sent:</b> Thursday, November 16, 2017 10:51 AM<br>
<b>To:</b> vishwa <vishwa@linux.vnet.ibm.com><br>
<b>Cc:</b> Brad Bishop <bradleyb@fuzziesquirrel.com>; Tanous, Ed <ed.tanous@intel.com>; OpenBMC <openbmc@lists.ozlabs.org><br>
<b>Subject:</b> Re: Use of Boost in OpenBMC<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Google doesn't use Boost internally and in general have no objections to this.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">My biggest concern is how it might impact our servers with limited BMC memory (128MB).  It's already been an issue tweaking OpenBMC to run on it without memory issues, and it's been a constant battle.  It doesn't always fail gracefully
 either.  Maybe the answer is to specify minimum requirements for running OpenBMC, such as 512MB RAM.<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">----------<br>
Nancy<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Nov 15, 2017 at 4:33 AM, vishwa <<a href="mailto:vishwa@linux.vnet.ibm.com" target="_blank">vishwa@linux.vnet.ibm.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">I like the proposal of using Boost when it makes more sense.<br>
<br>
As an example, In one of the recent code development, I was looking for string tokenizer support and could not see that in C++ and Boost had a good support of that. I ended up using strtok_r for that development.<span style="color:#888888"><br>
<br>
<span class="hoenzb">!! Vishwa !!</span></span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
On 11/14/2017 05:49 AM, Brad Bishop wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">On Nov 13, 2017, at 3:36 PM, Tanous, Ed <<a href="mailto:ed.tanous@intel.com" target="_blank">ed.tanous@intel.com</a>> wrote:<br>
<br>
All,<br>
  I’d like to start a discussion around the thoughts about the inclusion of Boost headers.  I’ve heard before that it’s a controversial subject.<br>
  For record, here’s what the style guide currently says:<br>
  Boost, QT, etc.<br>
  If you give a mouse a cookie...<br>
While, in general, we appreciate reuse over rewriting, we are not using large general-purpose libraries such as Boost. Due to 'Code should be performant: code size' we do not want to utilize the entirety of Boost. If approval is given for a single part of a
 large general-purpose library it becomes much more difficult to disapprove of another part of the library. Before long, we may have effectively approved of the entire library.<br>
  We do look for single feature libraries that can be used in place of our own implementations.<br>
  I’d like to start a discussion around challenging a core tenant of this statement, that approval of one part of the library makes it difficult to disapprove other parts.  I would argue that the overhead of making a library available, while still rejecting
 improper use that effects the project, is much lower than rewriting and debugging equivalent “new” components for openbmc.<br>
  I would like to update the coding style conventions with the below verbiage in regards to boost.<br>
  Boost<br>
  Use of boost is allowed, under the following circumstances:<br>
1.       Use is done as a header-only library.  This allows unused functions and methods to be removed by the compiler at link time, and avoids adding large amounts of overhead and flash usage.<br>
2.       Implementers should include the lowest level header required to solve the problem at hand.  This allows uses to be found and moved forward when new standards are available, as well as reduce compile times, and decrease the possibility of accidental
 use.  (ie, #include <boost/container/flat_map.hpp>  not #include <boost/container.hpp>)<br>
3.       The module used should not have an equivalent in the std namespace that meets the same requirements for implementation or clarity:  For example, std::chrono should be preferred over boost::chrono.  std::array over boost::array.<br>
4.       Use does not conflict with any of the core tenants of this coding standard (clarity, modern practices, or performance)<br>
    Some examples of libraries in boost that (I believe) would be useful for openbmc:<br>
Boost containers (flat_map, flat_set, ect)<br>
                 Among other things, this module provides standards compliant containers backed by a sorted vector.  This allows a reduced memory footprint over using std::set or std::map, and in certain use cases can be more performant, or lower memory usage.<br>
  Boost asio<br>
                 This module provides C++ level networking, sockets, SSL, and asynchronous frameworks that are not available in C++ today.  It has been proposed as a Networking TS to the C++ standards committee. 
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4656.pdf" target="_blank">
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4656.pdf</a>  This use would likely align us with moving toward compliant standards in the future.<br>
  Boost string<br>
                 Implementations of common string operations not present in the standard library.  String join, split, case insensitive compare ect.<br>
    I’d like to see what other people opinions are on the matter, and see if we can reach a consensus.<br>
  Thanks,<br>
  -Ed<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
This has my support.  I think (hope?) we can rely on a rigorous peer review process to flush out and raise awareness of any questionable usage.<br>
<br>
Would it make sense to have another bullet point documented somewhere to this effect?<br>
<br>
"If you are considering a boost component, it is suggested you outline your intended usage publicly (the mailing list) to avoid wasted effort if the community does not feel the specific usage is appropriate."<br>
<br>
-brad<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>