<?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: Scripting and very large files in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461195#M70621</link>
    <description>&lt;P&gt;You might be able to run the code with the JSL debugger/profiler, or just instrument it with finer-grained time_start..time_end like you are doing. My guess is the code has an N^2 behavior (4X time for doubling the data) for some reason with the includes. Maybe a namespace issue with some name that collides with a name in the data table.&lt;/P&gt;
&lt;P&gt;One place that could be bad is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_summary &amp;lt;&amp;lt; select where( Contains( Test_names, :Test_Instance ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it is hard to know without timing it. If Test_names might have 1e6 items and dt_summary might have 1e6 rows, on the average 500,000 test_names would be examined on each of the 1e6 rows. Or maybe there is only 10 or so and it isn't an issue. You might want to rewrite it, approximately like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// untested. combine two loops and use an aa rather than a list for lookup
Test_names = AssociativeArray();
For Each Row( 
	If( ( Contains( dt_summary:Test_Instance, "CHAR_char" )),
		Test_names[ dt_summary:Test_Instance ] = 1 
	)
);
dt_summary &amp;lt;&amp;lt; select where(  Test_names&amp;lt;&amp;lt;Contains( :Test_Instance ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The associative array will be much faster if the list has several hundred items.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use the JSL profiler, don't do the 3 hour run for your first profiling experience.Try a small program, using an include, and make sure you play with these buttons:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Something in the toolbox" style="width: 615px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40028i33136F2D5B558A08/image-size/large?v=v2&amp;amp;px=999" role="button" title="StartProfiler.PNG" alt="Something in the toolbox" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Something in the toolbox&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="A new window opens, the clock is for timing JSL." style="width: 658px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40029iDC250C5F2E3A011C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerMode.PNG" alt="A new window opens, the clock is for timing JSL." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;A new window opens, the clock is for timing JSL.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="The tooltip for the icon says &amp;quot;run profiler&amp;quot;." style="width: 776px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40030i48E0891C7DEBDCC5/image-size/large?v=v2&amp;amp;px=999" role="button" title="RunProfiler.PNG" alt="The tooltip for the icon says &amp;quot;run profiler&amp;quot;." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;The tooltip for the icon says "run profiler".&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;you might be able to use the blue pause button or wait for it to end, then examine the hot spots:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabs for sources" style="width: 770px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40031iC157EBFF1639344C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerResultsFile1.PNG" alt="tabs for sources" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;tabs for sources&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabs for sources" style="width: 760px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40032iE8A37D9AEA3F3722/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerResultsFile2.PNG" alt="tabs for sources" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;tabs for sources&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 00:57:54 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2022-02-16T00:57:54Z</dc:date>
    <item>
      <title>Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/460883#M70588</link>
      <description>&lt;P&gt;I have a script that imports many files and concatenates them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This file can be &amp;gt;41 million rows and be in the 10's of Gigabits (I have 100's of GB free space and 128GB memory : Using JMP16.2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then have scripts to select rows and columns and such.&amp;nbsp; My question really is not about scripting per se, but why if I run each script in order versus having a script that includes all the scripts, JMP "hangs".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g., Everything appears to work in that if I run each JSL in order, it works&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1.&amp;nbsp; Concat_files.JSL&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2.&amp;nbsp; Change_Test_Instance_Name.JSL&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3.&amp;nbsp; Summarize_Test_Instance.JSL&lt;/P&gt;&lt;P&gt;vs&lt;/P&gt;&lt;P&gt;a Script that runs each of the above for me...&lt;/P&gt;&lt;P&gt;E.g.,&lt;/P&gt;&lt;P&gt;Run_all_scripts.JSL&lt;/P&gt;&lt;P&gt;include("ADDIN_HOME(my_scripts)\Concat_files.jsl");&lt;/P&gt;&lt;P&gt;include(("ADDIN_HOME(my_scripts)\Change_Test_Instance_Name.JSL");&lt;/P&gt;&lt;P&gt;include("ADDIN_HOME(my_scripts)\Summarize_Test_Instance.JSL.jsl");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This just hangs my system....&amp;nbsp; I have the log open and I can tell it is stuck in the next script (Log shows a show statement like show("Entering Change_Test_Instance name");&lt;/P&gt;&lt;P&gt;I have tried using wait(); statements between each include (and within each of the scripts), but that still does not work.&amp;nbsp; Is there anything else I should try?&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>Sat, 10 Jun 2023 23:44:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/460883#M70588</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2023-06-10T23:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/460922#M70591</link>
      <description>&lt;P&gt;Are you opening/closing report windows, 100s or 1000s perhaps? Not opening the windows at all might help, a lot. (Possibly the OS isn't getting a chance to clean something up.)&lt;/P&gt;
&lt;P&gt;Are you printing 1000s of lines to the JMP 16 log? There is a pref to use the old log format that might help.&lt;/P&gt;
&lt;P&gt;Task manager might provide some insight. Look at handles and GDI objects as well as the obvious memory and disk culprits.&lt;/P&gt;
&lt;P&gt;Or check the disk light on the front of the computer, if you have one. It doesn't sound like you should be paging, that's a nice computer!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to know what was happening when you get an answer; if nothing above helps, tech support can help too.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 01:56:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/460922#M70591</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-02-15T01:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461097#M70607</link>
      <description>&lt;P&gt;I let the script run to see if it was stuck (appears it was running, but it takes hours, not minutes when running within a script).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I only have show statements in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is log output for running scripts within a script.&amp;nbsp; (The "changing to one test instance" takes 3.65 hours vs 3.65 minutes if i run the same script myself on the same file).&amp;nbsp; The CPU was running 12 cores (CPU0 to CPU11) about 20% for the 3.65 hours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the log(s) and a snippet of the JSL below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;N Items(files_open) = 12;
"Files are Concatenated ";
As Date(Today()) = 14Feb2022:13:00:32;
start_time - As Date(Today()) = -492;
"Saving Digital_shmoo_all";
As Date(Today()) = 14Feb2022:13:00:54;
"Done Saving Digital_shmoo_all";
As Date(Today()) = 14Feb2022:13:01:24;
"Changing to one test instance";
N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 14Feb2022:13:01:39;
"Reducing Test Instances Ended";
As Date(Today()) = 14Feb2022:16:41:13;
start_time - As Date(Today()) = -13174;
"Transposing";
"File has been transposed";
As Date(Today()) = 14Feb2022:16:42:23;
start_time - As Date(Today()) = -69;&lt;/PRE&gt;
&lt;P&gt;If I run the the reduce test instance script by itself with the same large file, here is the log&lt;/P&gt;
&lt;PRE&gt;As Date(Today()) = 14Feb2022:13:01:24;
"Changing to one test instance";
N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 14Feb2022:13:01:39;
"Reducing Test Instances Ended";
As Date(Today()) = 14Feb2022:16:41:13;
start_time - As Date(Today()) = -13174;
"Transposing";
"File has been transposed";
As Date(Today()) = 14Feb2022:16:42:23;
start_time - As Date(Today()) = -69;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basics of this script is finding names that start with "Char_Char" and changing them so they do not have "Char_Char"&amp;nbsp; ;&amp;nbsp; Doing this by creating a summary table, selecting the rows in the summary table that have "Char_Char", getting the rows in the main table that are selected, then changing the name in the main table.&amp;nbsp; Here is a snipping of the slow script.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;One_Test_Instance.JSL

dt = Current Data Table();

Names Default To Here( 1 );
Show( N Rows( dt ), "In Reduce_Test_Instance" );
Show( As Date( Today() ) );
start_time = As Date( Today() );
dt &amp;lt;&amp;lt; clear select;
dt &amp;lt;&amp;lt; clear column selection;
Wait();

Test_names = {};

dt &amp;lt;&amp;lt; Summary(
	Group( :Test_Instance ),
	Freq( "None" ),
	Weight( "None" ),
	output table name( "Summary_of_Table" )
);
dt_summary = Current Data Table();
Wait();


For Each Row( Insert Into( Test_names, dt_summary:Test_Instance ) );
Wait();
For( i = N Items( Test_names ), i &amp;gt; 0, i--,
	If( (!Contains( Test_names[i], "CHAR_char" )),
		Remove From( Test_names, i )
	)
);
dt_summary &amp;lt;&amp;lt; select where( Contains( Test_names, :Test_Instance ) );
Wait();
aa = dt &amp;lt;&amp;lt; get selected rows;&amp;nbsp; //Get selected rows in main table
Wait();
Close( dt_summary, nosave );

If( N Rows( aa ) &amp;gt; 0,
	(dt:Test_instance[aa]) = "CHAR_char_meas_TI";
	(dt:Setup[aa]) = "meas_TI";&amp;nbsp; //Change name in main table

);


dt &amp;lt;&amp;lt; clear select;
dt &amp;lt;&amp;lt; clear column selection;
Wait();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Feb 2022 19:25:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461097#M70607</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2022-02-15T19:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461102#M70608</link>
      <description>&lt;P&gt;Looks like I pasted same log....&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is when Running alone...&amp;nbsp; 200s or about 3.33minutes&lt;/P&gt;
&lt;PRE&gt;N Rows(dt) = 41929065;
"In Reduce_Test_Instance";
As Date(Today()) = 15Feb2022:10:11:57;
"Reducing Test Instances Ended";
As Date(Today()) = 15Feb2022:10:15:17;
start_time - As Date(Today()) = -200;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 19:27:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461102#M70608</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2022-02-15T19:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461195#M70621</link>
      <description>&lt;P&gt;You might be able to run the code with the JSL debugger/profiler, or just instrument it with finer-grained time_start..time_end like you are doing. My guess is the code has an N^2 behavior (4X time for doubling the data) for some reason with the includes. Maybe a namespace issue with some name that collides with a name in the data table.&lt;/P&gt;
&lt;P&gt;One place that could be bad is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_summary &amp;lt;&amp;lt; select where( Contains( Test_names, :Test_Instance ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it is hard to know without timing it. If Test_names might have 1e6 items and dt_summary might have 1e6 rows, on the average 500,000 test_names would be examined on each of the 1e6 rows. Or maybe there is only 10 or so and it isn't an issue. You might want to rewrite it, approximately like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// untested. combine two loops and use an aa rather than a list for lookup
Test_names = AssociativeArray();
For Each Row( 
	If( ( Contains( dt_summary:Test_Instance, "CHAR_char" )),
		Test_names[ dt_summary:Test_Instance ] = 1 
	)
);
dt_summary &amp;lt;&amp;lt; select where(  Test_names&amp;lt;&amp;lt;Contains( :Test_Instance ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The associative array will be much faster if the list has several hundred items.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use the JSL profiler, don't do the 3 hour run for your first profiling experience.Try a small program, using an include, and make sure you play with these buttons:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Something in the toolbox" style="width: 615px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40028i33136F2D5B558A08/image-size/large?v=v2&amp;amp;px=999" role="button" title="StartProfiler.PNG" alt="Something in the toolbox" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Something in the toolbox&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="A new window opens, the clock is for timing JSL." style="width: 658px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40029iDC250C5F2E3A011C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerMode.PNG" alt="A new window opens, the clock is for timing JSL." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;A new window opens, the clock is for timing JSL.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="The tooltip for the icon says &amp;quot;run profiler&amp;quot;." style="width: 776px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40030i48E0891C7DEBDCC5/image-size/large?v=v2&amp;amp;px=999" role="button" title="RunProfiler.PNG" alt="The tooltip for the icon says &amp;quot;run profiler&amp;quot;." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;The tooltip for the icon says "run profiler".&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;you might be able to use the blue pause button or wait for it to end, then examine the hot spots:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabs for sources" style="width: 770px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40031iC157EBFF1639344C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerResultsFile1.PNG" alt="tabs for sources" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;tabs for sources&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabs for sources" style="width: 760px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40032iE8A37D9AEA3F3722/image-size/large?v=v2&amp;amp;px=999" role="button" title="ProfilerResultsFile2.PNG" alt="tabs for sources" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;tabs for sources&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 00:57:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/461195#M70621</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-02-16T00:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting and very large files</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/462175#M70697</link>
      <description>&lt;P&gt;Sorry for the late reply(busy with work).&lt;/P&gt;&lt;P&gt;Thanks for the ideas.&amp;nbsp; I have never used the debugger.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will look at the namespace idea as well.&amp;nbsp; I have also found that if I have the main DT open (it has been concatenated) and then run the script with include statement it also runs as fast as when I run the script as is (no include).&amp;nbsp; So something about the main data table being in memory for a while vs concatenating then immediately running the include script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 17:02:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-and-very-large-files/m-p/462175#M70697</guid>
      <dc:creator>justvince</dc:creator>
      <dc:date>2022-02-18T17:02:08Z</dc:date>
    </item>
  </channel>
</rss>

