snap version(not much features cuz they weren't used back then)Snap! Build Your Own Blocks
Snap! Build Your Own Blocks
One thing you could try to speed it up is to make use of Snaps hyperblocks, since they are often much faster than MAP:
Using it in your prime spiral project (because I find it pretty cool) makes it run smooth as butter for me. I wasn't able to compare it to your javascipt version though because for some reason, even after loading the matrix module, I still get error messages.
Edit: I only tested this block in this project. No clue if it actually does the right thing in other/special cases.
Yeah, could you say more about why our matrix support (hyperblocks, COLUMNS, and RESHAPE) aren't adequate? There's a matrix multiplication block in the APL library, but it suffers a bit from being very general.
Whaa?Gotta check it out
Hmm if it works I'll do vector applying by transposing the vector and matrix multiply
Inner product?Isn't that another name for dot product?
Whaa?How did that work?
- Click the load script block.
It does not get errors on my side.
Oops!I shouldn't have made the deep compare block!The snap one seems the same on matrices!
I'll try simulating a 3d game and tally framerate(by simulate,i mean applying rotation matrices to 10000 dots every second)
On my computer,on average I need 278.2 milliseconds to render 10000 points.Which is a lot of points in a snap game!(please,if you want textures,use pumpkinhead's quad texture project,and DO NOT simulate them one pixel at a time!)
Yes, it is, and usually people do it in the opposite order, because dot product is easy on its own:
I confess, it took me a while to debug matrix multiply, and I'm upset that I had to do two transpositions. although they're not just undoing each other.
I could not import your script!It was very naughty and concealed into a costume!
MULTIMAP is in the List Utilities library (the second one in the list, because it's super useful). It takes N+1 inputs, of which the first is a function of N inputs and the rest are equal-length lists. It goes down all the lists in parallel.
The new smart script pics load as code if you drag them into the Scripts tab, but load as pictures if you drag them into the Costumes tab.
Oh okay.I dragged it into the scripts tab and it did not work
Can you send a new script pic??????
The dot thing works but the other pic did not
Works for me. Try clicking on the picture in the forum, which will display it fullscreen, and from there there's a Download button.
ps:i looked at the forum just at the moment you posted
Your multiply block actually was SLOWER.
The fps test ran 296 ms instead of 278 for 10000 dots.
I had to hit recover
This is slower than my block by a factor of approx 3 to 5 percent if i did my numbers correctly(278->294)
I think that your version has a multimap instead of a nested map which has an additional zip block inside(but i don't think thats enough to make the difference cuz my version actually does n times column operation while you did 2 due to caching,and n is three so i should score 66% on that call,instead of 110% so maybe some other factor?)
I'm not surprised that it's slower, since there are several levels of abstraction, implemented in Snap! rather than as primitives. I think we should make multimap a primitive.
P.S. We could of course just add that capability to MAP, but we're agreed that that would put up too large a barrier for kids to get used to the simple case.
yeah i think so too
But there was only 2 calls in the fps tester so you effectively slew it down by 10ms/call?????
If you say so.
I spent too much time in my youth hanging out with AI people, who, back then, didn't worry much about timing. If the program worked at all, that was an accomplishment.