<?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: Making code faster using Global Variable? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580087#M78344</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;
 Hi 
 &lt;A rel="user" href="https://answers.flexsim.com/users/226/jason.l.html" nodeid="226"&gt;@Jason Lightfoot&lt;/A&gt;,
 &lt;P&gt;Thanks for your quick response. I have 2 questions here:&lt;/P&gt;
 &lt;P&gt;1. What do you mean by bundle here? &lt;/P&gt;
 &lt;P&gt;2. I have to use the global table in 20 different object script in my model. what would you suggest in that case to make the run faster?&lt;/P&gt;
 &lt;P&gt;Thank you!&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 29 Sep 2023 10:03:56 GMT</pubDate>
    <dc:creator>rajankur6494</dc:creator>
    <dc:date>2023-09-29T10:03:56Z</dc:date>
    <item>
      <title>Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580085#M78342</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 23.1.0 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hi Team,&lt;/P&gt;
 &lt;P&gt;I am trying to optimize my model in terms of code. But I think I need some more understanding to make it successful.&lt;/P&gt;
 &lt;P&gt;Let say I have this code in my model:&lt;/P&gt;
 &lt;P id="isPasted"&gt;&lt;STRONG&gt;Table("Inputs").addRow();&lt;/STRONG&gt;&lt;/P&gt;
 &lt;P&gt;&lt;STRONG&gt;Table("Inputs")&lt;/STRONG&gt;&lt;TABLE&gt;[1]=Table("Inputs").numRows;&lt;P&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;Now, I have taken the reference of global table as global variable and I am using it in my model:&lt;/P&gt;
 &lt;P id="isPasted"&gt;&lt;STRONG&gt;Table(GV_Inputs).addRow();&lt;/STRONG&gt;&lt;/P&gt;
 &lt;P&gt;&lt;STRONG&gt;Table(GV_Inputs)&lt;/STRONG&gt;&lt;TABLE&gt;[1]=Table(GV_Inputs).numRows;&lt;P&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;I read in many post that if we use global variable, it works better. But it doesn't make any time difference for me. &lt;/P&gt;
 &lt;P&gt;Whether I am using it in the right way?&lt;/P&gt;
 &lt;P&gt;Thank you!&lt;/P&gt;
&lt;/TABLE&gt;&lt;/P&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 08:39:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580085#M78342</guid>
      <dc:creator>rajankur6494</dc:creator>
      <dc:date>2023-09-29T08:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580086#M78343</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Adding 3.8 million rows using the method you outline takes 6.416 seconds on my machine.&lt;/P&gt;&lt;P&gt;Using a Table local variable reduces that to 5.3 seconds.&lt;/P&gt;&lt;P&gt;Then changing the table to a bundle reduces it to 0.32 seconds.&lt;/P&gt;&lt;P&gt;The test script:&lt;/P&gt;&lt;PRE&gt;double start=realtime(1)+realtime(2)/1000;
Table t=Table("GlobalTable1");
for (int n=3800000;n&amp;gt;0;n--){
&amp;nbsp; &amp;nbsp; t.addRow();
&amp;nbsp; &amp;nbsp; t[t.numRows][1]=t.numRows;
}
return realtime(1)+realtime(2)/1000- start;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 09:43:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580086#M78343</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2023-09-29T09:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580087#M78344</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Hi 
 &lt;A rel="user" href="https://answers.flexsim.com/users/226/jason.l.html" nodeid="226"&gt;@Jason Lightfoot&lt;/A&gt;,
 &lt;P&gt;Thanks for your quick response. I have 2 questions here:&lt;/P&gt;
 &lt;P&gt;1. What do you mean by bundle here? &lt;/P&gt;
 &lt;P&gt;2. I have to use the global table in 20 different object script in my model. what would you suggest in that case to make the run faster?&lt;/P&gt;
 &lt;P&gt;Thank you!&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 10:03:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580087#M78344</guid>
      <dc:creator>rajankur6494</dc:creator>
      <dc:date>2023-09-29T10:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580088#M78345</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;1. A &lt;EM&gt;bundle&lt;/EM&gt; is a different way table data can be stored in FlexSim. By default, each cell of a global table is stored as a separate node. A bundle stores the entire table data in a single node. Using a bundle comes with some restrictions, which FlexSim will inform you about when you change a global table to a bundle. But access times will be much faster and the bundle columns can be indexed to significantly speed up queries.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="capture1.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1520308i50961F1D4A25968D/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture1.png" alt="capture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. If you think that accessing the table is slowing down the model, you can link a global variable to the data node of the table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="capture2.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1520309iC4214E69F1F2A2F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture2.png" alt="capture2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;Table tab = TableLink;&lt;/PRE&gt;&lt;P&gt;Though as Jason's test shows, the gain from this is minor compared to using a bundle table instead of a node table.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 10:20:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580088#M78345</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2023-09-29T10:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580089#M78346</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Thank you 
 &lt;A rel="user" href="https://answers.flexsim.com/users/19365/felixmh.html" nodeid="19365"&gt;@Felix Möhlmann&lt;/A&gt;
 &lt;P&gt;I would like to ask 1 question here:&lt;/P&gt;
 &lt;P&gt;What will be the difference if we are linking global table directly or we are linking data node?&lt;/P&gt;
 &lt;P&gt;Thank you!&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 10:36:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580089#M78346</guid>
      <dc:creator>rajankur6494</dc:creator>
      <dc:date>2023-09-29T10:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580090#M78347</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;I assume by "global table directly" you mean the table object? If you link that you would still need to get a reference to the data node by navigating its tree. You can only cast the data node (or any other node with bundle data or a fitting subnode structure) as a table.&lt;P&gt;The constructor &lt;STRONG&gt;Table() &lt;/STRONG&gt;also allows you to pass in the name of the table and then finds the data node automatically, but that is what you are trying to avoid, no?&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 10:58:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580090#M78347</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2023-09-29T10:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Making code faster using Global Variable?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580091#M78348</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Yes, you are correct.
 &lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/19365/felixmh.html" nodeid="19365"&gt;@Felix Möhlmann&lt;/A&gt; &lt;/P&gt;
 &lt;P&gt;Thanks for your explanation!&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 11:08:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/making-code-faster-using-global-variable/m-p/13580091#M78348</guid>
      <dc:creator>rajankur6494</dc:creator>
      <dc:date>2023-09-29T11:08:18Z</dc:date>
    </item>
  </channel>
</rss>

