cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

In this situation, should I use Python or JSL for the main controlling script?

lala
Level VIII

Now JMP can seamlessly connect with Python, and JSL and Python can call each other.

I have a task:

1. **Receive and extract data (py):** Every minute, use Python code to receive data from an API every 3 seconds. Extract structured data from the received data in real-time and store it in a memory array A. Immediately extract the data into another memory array B. Then, immediately clear memory array A to prepare for the next batch of data (this processing time is sufficient and will not cause blocking). At the end of the minute, use Python code to create a new JMP table (let's call it Table A) and write the structured data from memory array B into this JMP table. Finally, clear memory array B.

2. **Concatenate and stock selection (JSL):** Use JSL to append the data from the newly created JMP Table A to an existing JMP Table B. Perform stock selection calculations using technical indicators in JSL on the combined Table B. Then, close JMP Table A.

This process repeats continuously.

Which of the following two approaches is better for this situation, with a focus on stable operation and reduced system resource consumption?

A. Within a single, overarching Python script, continuously run the data receiving/extraction (py) and the concatenation/stock selection (JSL) portions, using timers.

B. Within a single, overarching JSL script, continuously run the data receiving/extraction (py) and the concatenation/stock selection (JSL) portions, using timers.

 

Thanks!

11 REPLIES 11
lala
Level VIII


Re: In this situation, should I use Python or JSL for the main controlling script?

Thank you all experts for your answers.

I conducted a comparison between Python and JSL for a complex indicator calculation.
The time consumption differs by nearly 10 times.
I ran the full matrix when using JSL.
Since I'm not familiar with Python, I could only ask various AIs to implement it in Python according to this JSL logic.
The result shows that the modification by grok3 is the best.

2025-02-25_10-45-40.png


Re: In this situation, should I use Python or JSL for the main controlling script?

I agree with @Craige_Hales on the need to test each path.  When large data and high performance come into play there is no substitute for testing in your environment.  No real shortcut to say one is better than the other without testing and making measurements.  Even then performance tuning tips and tricks can be specific to each language.

 

There are some general principles.  

 

  • Do not handle, move, duplicate the data any more than strictly necessary.
  • Pay attention to O( ) of your code,  Unroll loops where possible avoid n^2 or worse algorithms.
  • Minimize filesystem access in critical areas and make sure memory doesn't grow beyond physical memory or you will be swapping to disk.  
    • Physical RAM vs Local SSD vs HDD vs Network drive.

In the quest for absolute performance you may need to test sections of your code to see which performs faster, JSL or Python.  For example, it may be faster to process data as a numpy array or pandas dataframe and convert to a data table all at once vs appending to a large data table in JSL (I haven't tested this, so I don't know, I'm just making an example.)  You need to test each major component of the pipeline when performance is critical.