Hello JMP community,
Lately, I was looking into improve the performance of my internal JSL scripts and I found the following performance issues that I would like to address.
Lets take the following script (JMP 17.2 PRO running on macOS):
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
values = Column( dt, 1 )[dt << get rows where( Excluded( Row State() ) != 1 )];
new window("test",
lb = list box( values, nlines(10), width(100), ),
b = button box("reset", reset_lb),
);
reset_lb = expr(
lb << remove all();
lb << append(values);
Nnames = N Items(values);
for(i = 1, i <= Nnames, i++,
lb << set selected(i);
);
);In some of my scripts I am using list boxes that are dynamically updated. For changing the content of the list boxes I use the << remove() and << append() functions, they work just fine but I am afraid that this method does not scale very well with the number of rows, another portion that surprisingly runs really slow is the for loop with << set selected(), apparently this is the only method that I could find for selecting all the items in a list box but it scales terribly with the number of rows.
My questions is if there are any best known ways to update the content of the list boxes that is not slow performance wise. I am looking for possible alternatives that would do:
- optimal method to set the content of the list box.
- fast way to select all the items of the list box.
Any feedback or suggestions would be greatly appreciated.