<?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: Does // String Concatenation do any dynamic allocation in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564623#M170481</link>
    <description>&lt;P&gt;No, few check assembly code except for trivial examples. I do it in cases such as your question as it's the easiest way to see what's actually happening - assuming that one can read and understand the assembly! I used to write assembler code decades ago, would not even consider doing so today.&lt;/P&gt;</description>
    <pubDate>Sat, 20 Jan 2024 22:03:39 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2024-01-20T22:03:39Z</dc:date>
    <item>
      <title>Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564411#M170470</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to write my Fortran is a high performance style. My strategy for doing this is to avoid anything dynamic (ie that has to be decided at runtime) in order to give the compiler the best chance of optimising things.&lt;/P&gt;&lt;P&gt;So I am happy to use modern features like Derived Types, but would avoid EXTENDS as this would then involve dynamic type binding, limiting the foresight of the compiler.&lt;/P&gt;&lt;P&gt;In this vein I also want to avoid dynamic memory allocation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering what // and TRIM in particular actually do. Does the compiler create its own string of length equal to the length of all the Strings concatenated with // or is a String allocated dynamically at runtime? Also does TRIM allocate a new String dynamically or just work with the original string and a substring index equal to the last non blank?&lt;/P&gt;&lt;P&gt;Please feel free to correct false assumptions in the above points. Also I am using the "&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference" which although excellent in terms of specifying inputs and outputs, doesn't give many hints about underlying implications or what is actually going on? Is there another document with this kind of information for each intrinsic function and operator?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Thank you for your help.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 18:14:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564411#M170470</guid>
      <dc:creator>c_armstrong</dc:creator>
      <dc:date>2024-01-19T18:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564460#M170472</link>
      <description>&lt;P&gt;It depends on the context. By default, if a temporary value is needed it will be created on the stack. Assuming you're not using deferred-length allocatable variables, assigning a concatenation doesn't need a temp at all.&amp;nbsp; My experiments with TRIM don't show it creating a temp.&amp;nbsp; The heap-arrays option tells the compiler to dynamically allocate any temps it needs.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 20:27:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564460#M170472</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-01-19T20:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564530#M170477</link>
      <description>&lt;P&gt;Thank you. So from the fact you did experiments, the best way to answer those sort of questions is to experiment i.e. there isn't a standard reference on such issues?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 06:24:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564530#M170477</guid>
      <dc:creator>c_armstrong</dc:creator>
      <dc:date>2024-01-20T06:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564584#M170479</link>
      <description>&lt;P&gt;There is not - the Fortran standard says what the results should be, but not how it is achieved. Also, the answer to how a compiler does something can change over time.&lt;/P&gt;&lt;P&gt;My usual advice is to write code that is readable and does not complicate things in the pursuit of micro-optimization. The compiler optimizes straightforward code the easiest. You can run the program through a performance analyzer, such as Intel VTune, to see where time is being spent if you feel performance is not where you want. The hot spots are usually not where you think they are.&lt;/P&gt;&lt;P&gt;If you really want to make sure you're not using dynamic allocation, generate a link map and search the list of symbols for the string "alloc". I think this will catch them all.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 15:08:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564584#M170479</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-01-20T15:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564606#M170480</link>
      <description>&lt;P&gt;Thanks. I'll make a mental note of the link map trick. Do expert level Fortran programmers check the assembly code much? My first job was Fortran but then went down the Java etc route for readability, maintainability reasons. Diving back into Fortran as got a use case where microoptimisation is the name of the game!&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 18:49:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564606#M170480</guid>
      <dc:creator>c_armstrong</dc:creator>
      <dc:date>2024-01-20T18:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Does // String Concatenation do any dynamic allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564623#M170481</link>
      <description>&lt;P&gt;No, few check assembly code except for trivial examples. I do it in cases such as your question as it's the easiest way to see what's actually happening - assuming that one can read and understand the assembly! I used to write assembler code decades ago, would not even consider doing so today.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 22:03:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Does-String-Concatenation-do-any-dynamic-allocation/m-p/1564623#M170481</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-01-20T22:03:39Z</dc:date>
    </item>
  </channel>
</rss>

