<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Interesting performance issue with String functions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125087#M1708113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in version one to make the "&amp;amp;&amp;amp;" operator work, you need to build an intermediate expression result for the part to the right of "&amp;amp;&amp;amp;". It has to be stored somwhere, so that "&amp;amp;&amp;amp;" can be processed afterwards, and as soon as the expression is calculated, this interimspace has to be deallocated to avoid a memory leak. Sounds pretty expensive to me, esp. on unicode systems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Version 2, the compiler probably recognizes, that the storage will be in lv_html_data2 (left of =), so no need for dynamic allocation and de-allocation of the interim result for concatenation. The target lv_html_data2 stays static.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The memorymanagement for the target, which gets longer in each loop is the same in both cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it is just guessing, I have no trace for proof.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as the compared systems are involved, any unicode / non-unicode derivations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2012 10:32:37 GMT</pubDate>
    <dc:creator>volker_borowski2</dc:creator>
    <dc:date>2012-12-07T10:32:37Z</dc:date>
    <item>
      <title>Interesting performance issue with String functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125085#M1708111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was working on a performance issues on a 7.02 system and discovered that a very small change in the code made a dramatic difference to the performance. I have created a very simple program to illustrate this. The program is attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="445"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="152"&gt;&lt;P&gt;&lt;STRONG&gt;Number of records&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-left: none; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P&gt;&lt;STRONG&gt;Version one&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-left: none; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P&gt;&lt;STRONG&gt;Version two&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-left: none; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="85"&gt;&lt;P&gt;&lt;STRONG&gt;% Change&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-top: none; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="152"&gt;&lt;P&gt; 100 &lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;239&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;161&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="85"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;33%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-top: none; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="152"&gt;&lt;P&gt; 1,000 &lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;7626&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;1590&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="85"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;79%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-top: none; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="152"&gt;&lt;P&gt; 10,000 &lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;945,304&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;16,783&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FDE9D9; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="85"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;98%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid #fabf8f 1.0pt; border-top: none; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="152"&gt;&lt;P&gt; 100,000 &lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;169,005,062&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="104"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;860,739&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid #FABF8F 1.0pt; border-right: solid #FABF8F 1.0pt; background: #FCD5B4; padding: 0 5.4pt 0 5.4pt;" valign="bottom" width="85"&gt;&lt;P align="right" style="margin-top: auto; margin-bottom: auto; text-align: right;"&gt;99%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have sent the program to two of the SAP ABAP Mentors, Graham Robinson and Thomas Jung. Graham has run the program on a 7.31 system and had similar results. Thomas is fortunate to a 7.40 system and his results show the opposite result but the difference were very small.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am interested to hear if anybody has an explanation as to why there is such a dramatic difference in performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Brent Talbot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 18:30:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125085#M1708111</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-12-06T18:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting performance issue with String functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125086#M1708112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;The version 1 code is:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; LOOP AT lt_data REFERENCE INTO lr_data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lv_html_data =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lv_html_data &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;lt;OPTION from="unalloc" VALUE="{ lr_data-&amp;gt;anumber }" birthid=""&amp;gt;{ lr_data-&amp;gt;anumber }|.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;The Version 2 code which runs significantly faster is&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; LOOP AT lt_data REFERENCE INTO lr_data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lv_html_data2 =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;lt;OPTION from="unalloc" VALUE="{ lr_data-&amp;gt;anumber }" birthid=""&amp;gt;{ lr_data-&amp;gt;anumber }|.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lv_html_data3 = lv_html_data3 &amp;amp;&amp;amp; lv_html_data2.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ENDLOOP&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 03:10:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125086#M1708112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-12-07T03:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting performance issue with String functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125087#M1708113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in version one to make the "&amp;amp;&amp;amp;" operator work, you need to build an intermediate expression result for the part to the right of "&amp;amp;&amp;amp;". It has to be stored somwhere, so that "&amp;amp;&amp;amp;" can be processed afterwards, and as soon as the expression is calculated, this interimspace has to be deallocated to avoid a memory leak. Sounds pretty expensive to me, esp. on unicode systems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Version 2, the compiler probably recognizes, that the storage will be in lv_html_data2 (left of =), so no need for dynamic allocation and de-allocation of the interim result for concatenation. The target lv_html_data2 stays static.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The memorymanagement for the target, which gets longer in each loop is the same in both cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it is just guessing, I have no trace for proof.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as the compared systems are involved, any unicode / non-unicode derivations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 10:32:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125087#M1708113</guid>
      <dc:creator>volker_borowski2</dc:creator>
      <dc:date>2012-12-07T10:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting performance issue with String functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125088#M1708114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In 7.40, the ABAP runtime goes to greater effort to determine that there is no right-hand-side occurrence of the target variable and hence it can be appended directly. (If there was a rhs occurrence, direct append would be invalid.) In 7.20, this recognition only works for the simple form in version 2, and version 1 has quadratic run time, as speculated by Volker.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2012 08:40:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/interesting-performance-issue-with-string-functions/m-p/9125088#M1708114</guid>
      <dc:creator>former_member183770</dc:creator>
      <dc:date>2012-12-10T08:40:54Z</dc:date>
    </item>
  </channel>
</rss>

