<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi,<br>
    <br>
    I revisited my osgText performance issue by measuring the time for
    copying text.<br>
    <br>
    With some 150,000 copies of my VertexNumber class inheriting from
    osgText::Text, I ended up with roughly the following figures using
    OSG 3.5.6, compared to my previous solution using OSG 3.2.1, calling
    the osgText::TextBase copy constructor from my copy constructor
    (skipping over osgText::Text copy constructor) and copying the
    _textureGlyphQuadMap instead of calling the slower
    computeGlyphRepresentation.<br>
    <br>
    3.2.1 without the "trick" above:<br>
    40 - 70% slower compared to 3.2.1 with trick<br>
    <br>
    3.5.6 (obviously without the trick):<br>
    50 - 90% slower compared to 3.2.1 with trick<br>
    10 - 30% slower compared to plain 3.2.1 without trick<br>
    <br>
    Furthermore, in 3.5.6 my application requires about 37% more RAM
    with this number of texts, compared to 3.2.1 (both with and without
    the trick), but only about 4% more without the texts created.<br>
    <br>
    I'm creating and caching new text instances per vertex number in the
    model. Since there are mostly triangles, I'm getting 0,1,2 but also
    occasional other numbers up to 7 for special polygons. For a
    situation like this, with a large number of texts from a small
    number of cached originals, what would be the recommended approach?
    Maybe osgText isn't suitable at all?<br>
    <br>
    Regards,<br>
    Andreas<font size="2" color="black"><span
        style="font-size:0.8em;color:black"></span></font><br>
    <font size="2" color="black"><span
        style="font-size:0.8em;color:black"></span></font>
    <div class="moz-signature"><font size="2" color="black"><span
          style="font-size:0.8em;color:black">
          <br>
          <br>
        </span></font>
    </div>
    <div class="moz-cite-prefix">On 2017-08-18 11:38, Robert Osfield
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFN7Y+U0R-XswEA2z_fLcyuHAA=sYyLsYQNkT7rnS64SVEaMmA@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>Hi Andreas,<br>
              <br>
            </div>
            In my rewrite of osgText my approach was that the internal
            implementation details aren't meant to be something that
            users need to meddle with.<br>
            <br>
          </div>
          The fact that you are needing to meddle with the internal
          details to workaorund performance issues in your usage case
          suggest an issue with basic performance/flexibility,  The new
          implementation might change this performance/flexibility side
          so perhaps your local changes might not be needed.<br>
          <br>
        </div>
        <div>If the new osgText doesn't provide the performance you need
          for your usage case perhaps it could be optimized to handle
          them.  Creating an example that illustrates the usage case
          which highlights the issues would be a good first step if you
          feel this approach has promise.<br>
          <br>
        </div>
        <div>Finally, I'm open to small tweaks to the API allow easier
          subclassing. However, this isn't my preferred approach as any
          changes to the internals later would then break end user code
          that relies upon it - exactly the problem you are facing
          now...<br>
        </div>
        <div><br>
          Robert.<br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 18 August 2017 at 09:14, Andreas
          Ekstrand <span dir="ltr"><<a
              href="mailto:andreas.ekstrand@remograph.com"
              target="_blank" moz-do-not-send="true">andreas.ekstrand@remograph.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> Hi,<br>
              <br>
              With OSG 3.2.1 I have been able to do fast shallow cloning
              of osgText::Text in my own subclass, copying the
              _textureGlyphQuadMap instead of calling
              computeGlyphRepresentation, since the latter is a slow
              operation for my thousands of texts.<br>
              <br>
              In OSG 3.5.6 this isn't possible, I guess due to a private
              GlyphQuads::operator=. So I'm looping through
              _textureGlyphQuadMap in my copy constructor and copy its
              glyphs and primitives separately instead. But I can't see
              my copied text at all! If I save it out to an .osg or
              .osgt file it's visible in osgviewer.<br>
              <br>
              I guess setting GlyphQuads::operator= private was
              deliberate, so can someone explain how I can accomplish
              fast text cloning in OSG 3.5.6 or optimize it somehow?<br>
              <br>
              Regards,<br>
              Andreas<font size="2" color="black"><span
                  style="font-size:0.8em;color:black"><br>
                  <br>
                </span></font> </div>
            <br>
            ______________________________<wbr>_________________<br>
            osg-users mailing list<br>
            <a href="mailto:osg-users@lists.openscenegraph.org"
              moz-do-not-send="true">osg-users@lists.<wbr>openscenegraph.org</a><br>
            <a
href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>