cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
hogi
Level XI

Tips and Tricks - best practice with JMP/JSL

There is a wonderful blog post by @Craige_Hales : How Do You Draw a Circle? 

It illustrates very nicely that there are multiple solutions to every problem - with different levels of how well the goal was achieved.

 

And often there is not the ONE solution with maximum points in all categories:

  • goal was met
  • length of code
  • speed (to write the code)
  • speed (to execute the code)
  • complexity (to understand the code)
  • complexity ( to remember the code)

If you have to apply the same formula to millions of rows of thousands of columns, you will focus on speed (to execute the code).

 

Is there a white paper, webinar or community post that provides a list with all the tricks which way to go to make Jmp/JSL as fast as possible?

 

[More Topic Containers like this]

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: Speeding up JMP/JSL

 

topicstandard approachfaster approacheslinks
Data import   
get a list of filesgenerate the file list - via Python, command prompt etc. and paste it into a new JMP tableMFI
→ right click on file list → Make into data table
 
find a file in a deep/complicated network tree structureuse MFI or Windows File dialogcreate a wrapper for Python/GLOB  
Data tables   
replace values with other valuesfor loopuse DataTable subscriptingReplace missing values with 0
Should you Loop through a data table or use Recode, or use Get Rows Where to change values in a data...
add columns to a data tablemerge data tables via Tables/Updatefirst aggregate via  Tables/Summary
then merge via  Tables/Update
Speed up Tables/Update 
open multiple data filesuse open()  (inside a for loop)use MFI
(faster csv reader!)
Open multiple Files 
column aggregation
with restrictions (1)
the new approach via  Where (JMP18)
col Mean(:weight, :sex, where(:age==13))​
is easy to remember, but very slow

doesn't work yet.

use the old approach via If:

col Mean(if(:age=13,:weight,.) :sex)​

It looks more complicated but it's orders of magnitude faster *)
 

Col-Median-and-others:Where option 
column aggregation
with restrictions (2)

*) unfortunately, compared to the previous example, a similar expression with character comparison in the if clause is very slow:

col Mean( if(:sex=="M",:weight,.),:age)

->use if(:sex2==1,...):


before that:
add a numeric dummy column :sex2
(e.g. via tables/summary + rank)

How-do-I-use-the-Col-Maximum-Formula-with-a-where  

 count wordse.g. count xxx in :col:
N Rows(loc(Words(:col),"xxx"))
(Length(:col)-Length(Substitute(:col,"xxx","")))/3

Count number of occurrences of specific words in a string

rank unique 
New Column( "rank_unique (sex) by age",Formula(
	Col Minimum(
		Col Rank( If( Row() == Col Min( Row(), 
			:age, :sex ), 1 ), :age ),
	:age,:sex))
 Add dense ranking to Ranking Tie and Col Rank functions

 

   

 

    
Graphs   
    
    
Reports   
    
    
Export   
    
    
    
Database access   
    
    
    
Neural Networks   
    
    
    
...   
    

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Speeding up JMP/JSL

It depends a lot on what you are doing. Some good general tips can be found from Scripting Guide > Efficient Scripts 

-Jarmo
hogi
Level XI

Re: Speeding up JMP/JSL

Thanks, a good place to start ...

 

Going further, how about a list with as many entries as possible along the idea:
If you want to do this, you probably thought of this approach - but concerning speed, the other approach is much better!

 

Who is interested in sharing his secrets

hogi
Level XI

Re: Speeding up JMP/JSL

 

topicstandard approachfaster approacheslinks
Data import   
get a list of filesgenerate the file list - via Python, command prompt etc. and paste it into a new JMP tableMFI
→ right click on file list → Make into data table
 
find a file in a deep/complicated network tree structureuse MFI or Windows File dialogcreate a wrapper for Python/GLOB  
Data tables   
replace values with other valuesfor loopuse DataTable subscriptingReplace missing values with 0
Should you Loop through a data table or use Recode, or use Get Rows Where to change values in a data...
add columns to a data tablemerge data tables via Tables/Updatefirst aggregate via  Tables/Summary
then merge via  Tables/Update
Speed up Tables/Update 
open multiple data filesuse open()  (inside a for loop)use MFI
(faster csv reader!)
Open multiple Files 
column aggregation
with restrictions (1)
the new approach via  Where (JMP18)
col Mean(:weight, :sex, where(:age==13))​
is easy to remember, but very slow

doesn't work yet.

use the old approach via If:

col Mean(if(:age=13,:weight,.) :sex)​

It looks more complicated but it's orders of magnitude faster *)
 

Col-Median-and-others:Where option 
column aggregation
with restrictions (2)

*) unfortunately, compared to the previous example, a similar expression with character comparison in the if clause is very slow:

col Mean( if(:sex=="M",:weight,.),:age)

->use if(:sex2==1,...):


before that:
add a numeric dummy column :sex2
(e.g. via tables/summary + rank)

How-do-I-use-the-Col-Maximum-Formula-with-a-where  

 count wordse.g. count xxx in :col:
N Rows(loc(Words(:col),"xxx"))
(Length(:col)-Length(Substitute(:col,"xxx","")))/3

Count number of occurrences of specific words in a string

rank unique 
New Column( "rank_unique (sex) by age",Formula(
	Col Minimum(
		Col Rank( If( Row() == Col Min( Row(), 
			:age, :sex ), 1 ), :age ),
	:age,:sex))
 Add dense ranking to Ranking Tie and Col Rank functions

 

   

 

    
Graphs   
    
    
Reports   
    
    
Export   
    
    
    
Database access   
    
    
    
Neural Networks   
    
    
    
...   
    
hogi
Level XI

Re: Speeding up JMP/JSL

I added a cool trick to count words by @ian_jmp :
Count number of occurrences of specific words in a string 

hogi
Level XI

Re: Speeding up JMP/JSL

-