<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Array or list for sharing large immutable data between tasks?</title>
    <link>http://www.mapleprimes.com/questions/94724-Array-Or-List-For-Sharing-Large-Immutable</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 20:17:34 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 20:17:34 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Array or list for sharing large immutable data between tasks?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Array or list for sharing large immutable data between tasks?</title>
      <link>http://www.mapleprimes.com/questions/94724-Array-Or-List-For-Sharing-Large-Immutable</link>
    </image>
    <item>
      <title>lists passed by reference</title>
      <link>http://www.mapleprimes.com/questions/94724-Array-Or-List-For-Sharing-Large-Immutable?ref=Feed:MaplePrimes:Array or list for sharing large immutable data between tasks?:Comments#answer94730</link>
      <itunes:summary>&lt;p&gt;Lists and sets in Maple are always passed by reference, and there shouldn't be a lock to read them. &amp;nbsp;They are immutable. &amp;nbsp;You may find that garbage collection and other factors limit the parallel speedup of Maple code. &amp;nbsp;In general, simpler is better, and if there are performance problems then it's probably something that needs to be improved in the kernel.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Lists and sets in Maple are always passed by reference, and there shouldn't be a lock to read them. &amp;nbsp;They are immutable. &amp;nbsp;You may find that garbage collection and other factors limit the parallel speedup of Maple code. &amp;nbsp;In general, simpler is better, and if there are performance problems then it's probably something that needs to be improved in the kernel.&lt;/p&gt;</description>
      <guid>94730</guid>
      <pubDate>Sat, 03 Jul 2010 05:57:42 Z</pubDate>
      <itunes:author>roman_pearce</itunes:author>
      <author>roman_pearce</author>
    </item>
    <item>
      <title>should be ok</title>
      <link>http://www.mapleprimes.com/questions/94724-Array-Or-List-For-Sharing-Large-Immutable?ref=Feed:MaplePrimes:Array or list for sharing large immutable data between tasks?:Comments#answer94738</link>
      <itunes:summary>&lt;p&gt;You asked,&lt;br&gt; "if I hold the list as a private module variable and export a module procedure to&amp;nbsp;return the weights, is Maple going to make a copy of the list every time a task invokes my module's "GetWeights"&amp;nbsp;procedure?"&lt;/p&gt;
&lt;p&gt;&lt;span class="mainBody document"&gt;I believe that, if I understand your question properly, the answer is no. Maple only has one unique copy of any given list at any given time. If you assign into a list (or use subsop to try and cheat) then Maple creates a new list because (as Roman mentioned) lists are actually immutable. They may just appear to be mutable, by a Maple kernel sleight-of-hand.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="mainBody document"&gt;Consider the following example, and ask why the higher level list L is not changed. The answer is &lt;em&gt;not&lt;/em&gt; due to Maple passing a full copy of L into procedure p. It is because the later act of altering an entry of p's local T (with initial same ID as p's formal parameter LL) creates a new list. Note that the initial address of local T is the same as that of L, &lt;em&gt;prior&lt;/em&gt; to assignment into an entry of T. The copying of L occurred when T[3] was altered, and not when L was passed into `p`. Moral: if you don't try and alter LL (or T), you should be OK as far as non-copying goes for performance. So avoiding the rtable locks, by converting the weights to lists (after all weights are initially computed, of course) looks ok.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&amp;gt; L:=[1,3,5,7]:&lt;br&gt;&amp;gt; addressof(L);&lt;br&gt;                                  181177616&lt;br&gt;&amp;gt; p:=proc(LL)&lt;br&gt;&amp;gt;   local T;&lt;br&gt;&amp;gt;   T:=LL;&lt;br&gt;&amp;gt;   printf("initial address of T: %a\n",addressof(T));&lt;br&gt;&amp;gt;   T[3]:=z;&lt;br&gt;&amp;gt;   printf("subsequent address of T: %a\n",addressof(T));&lt;br&gt;&amp;gt;   T;&lt;br&gt;&amp;gt; end proc:&lt;br&gt;&lt;br&gt;&amp;gt; p(L);&lt;br&gt;initial address of T: 181177616&lt;br&gt;subsequent address of T: 193667904&lt;br&gt;                                [1, 3, z, 7]&lt;br&gt;&lt;br&gt;&amp;gt; L;&lt;br&gt;addressof(L);&lt;br&gt;                                [1, 3, 5, 7]&lt;br&gt;                                  181177616&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;Joke: If Maple didn't behave like this then its list performance would be trash, and we'd all be passing addressof(L) into a procs which initially set up list locals with pointto().&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;You asked,&lt;br&gt; "if I hold the list as a private module variable and export a module procedure to&amp;nbsp;return the weights, is Maple going to make a copy of the list every time a task invokes my module's "GetWeights"&amp;nbsp;procedure?"&lt;/p&gt;
&lt;p&gt;&lt;span class="mainBody document"&gt;I believe that, if I understand your question properly, the answer is no. Maple only has one unique copy of any given list at any given time. If you assign into a list (or use subsop to try and cheat) then Maple creates a new list because (as Roman mentioned) lists are actually immutable. They may just appear to be mutable, by a Maple kernel sleight-of-hand.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="mainBody document"&gt;Consider the following example, and ask why the higher level list L is not changed. The answer is &lt;em&gt;not&lt;/em&gt; due to Maple passing a full copy of L into procedure p. It is because the later act of altering an entry of p's local T (with initial same ID as p's formal parameter LL) creates a new list. Note that the initial address of local T is the same as that of L, &lt;em&gt;prior&lt;/em&gt; to assignment into an entry of T. The copying of L occurred when T[3] was altered, and not when L was passed into `p`. Moral: if you don't try and alter LL (or T), you should be OK as far as non-copying goes for performance. So avoiding the rtable locks, by converting the weights to lists (after all weights are initially computed, of course) looks ok.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&amp;gt; L:=[1,3,5,7]:&lt;br&gt;&amp;gt; addressof(L);&lt;br&gt;                                  181177616&lt;br&gt;&amp;gt; p:=proc(LL)&lt;br&gt;&amp;gt;   local T;&lt;br&gt;&amp;gt;   T:=LL;&lt;br&gt;&amp;gt;   printf("initial address of T: %a\n",addressof(T));&lt;br&gt;&amp;gt;   T[3]:=z;&lt;br&gt;&amp;gt;   printf("subsequent address of T: %a\n",addressof(T));&lt;br&gt;&amp;gt;   T;&lt;br&gt;&amp;gt; end proc:&lt;br&gt;&lt;br&gt;&amp;gt; p(L);&lt;br&gt;initial address of T: 181177616&lt;br&gt;subsequent address of T: 193667904&lt;br&gt;                                [1, 3, z, 7]&lt;br&gt;&lt;br&gt;&amp;gt; L;&lt;br&gt;addressof(L);&lt;br&gt;                                [1, 3, 5, 7]&lt;br&gt;                                  181177616&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;Joke: If Maple didn't behave like this then its list performance would be trash, and we'd all be passing addressof(L) into a procs which initially set up list locals with pointto().&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>94738</guid>
      <pubDate>Sat, 03 Jul 2010 10:10:11 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>I'm sold</title>
      <link>http://www.mapleprimes.com/questions/94724-Array-Or-List-For-Sharing-Large-Immutable?ref=Feed:MaplePrimes:Array or list for sharing large immutable data between tasks?:Comments#comment94765</link>
      <itunes:summary>&lt;p&gt;Thanks for the prompt and thorough explanations, gents. Now that FIFA is resting for a couple of days, I'll get back to work.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;- Jimmy&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks for the prompt and thorough explanations, gents. Now that FIFA is resting for a couple of days, I'll get back to work.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;- Jimmy&lt;/p&gt;</description>
      <guid>94765</guid>
      <pubDate>Sun, 04 Jul 2010 08:19:26 Z</pubDate>
      <itunes:author>jimmyinhmb</itunes:author>
      <author>jimmyinhmb</author>
    </item>
  </channel>
</rss>