jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.52k stars 748 forks source link

sort in list utilities library very slow #2440

Open ToonTalk opened 5 years ago

ToonTalk commented 5 years ago

Sorting 1000 numbers took almost 8 seconds on my laptop. Project attached.

image

sort timer.zip

jmoenig commented 5 years ago

Yeah, better to use the JIT-compiled version in the bigger data or frequency distribution analysis libraries.

bromagosa commented 5 years ago

I can confirm using the bigger data sort is almost instant. It's building the actual list that takes most of the time (warping the repeat block fixes that too).

brianharvey commented 5 years ago

I've been poking at this. One issue is that using a plain build-your-own block is a lot faster than CALLing a lambda that you've put in a script variable because we don't have inner definitions.

jmoenig commented 5 years ago

@brianharvey as an old Smalltalker I wouldn't take any issue with a separate helper block in the palette, especially if it makes SORT faster...