Allocating code and requesting memory

There are two blocks that I would like considered for the next Snap! update:

  1. A block similar to the "warp" block that allows you to run code on the CPU or GPU only.
  2. A block that requests a specific amount of memory on your computer and reserves it (to prevent lag spikes)

I don't think this is possible in the web browser. Correct me if I'm wrong.

Browsers do it automatically, so I'm sure there's a way to do it manually, but I hope a developer finds this so we can get a solid answer.

well, not matter what, I seriously doubt this would even be considered, because it's just a little too advanced for snap.

It is quite complicated but I meant for it to be in an extension like "Snap! Science"

Well, if you know how to do it in javascript, then you can create your own snap extension. Snap extensions don't have to be made by just the snap devs.

That doesn't follow. Lispians have known since the '60s, and everyone else has known since the '80s, that human beings suck at memory allocation, so modern programming languages don't let human beings anywhere near it. You can write anything you want, but there's no way we'd add it to the language or the (official) libraries.

Allocating code may be off-limits but is my idea for reserving memory for future use feasible?

Why would you do that? That just sounds like a memory hog.

#2 is impossible because javascript has no way to pre-allocate memory for... what exactly?

i think #1 is theoretically possible but very unlikely it will be implemented. for that to work, snap code would need to be compiled to GLSL which is a language that is statically typed and does not support recursion. also, it wouldn't be able to access variables/data outside the "warp" whenever it wanted to, because those live in a separate component of the computer.

but you can use the JavaScript function block to access the GPU. you can use codification to convert snap code to GLSL. i once made a project demoing that. i'm guessing you want that for your 3d raycaster.

Computers store data by first, creating a key that says where the data is and then storing it. What you can do is create a key and not put anything where the key goes. It would be a memory hog in some situations but since there is nothing in the slot your computer doesn't have to process it.

#2 Browsers try to use as little memory as possible so if you have a RAM-heavy project there will be lots of lag spikes while your computer is trying to move everything around. This reserves extra memory to try and reduce that. Mainly it's something I would use because my program is running a function for every pixel on the screen and storing the data, so it would be handy if it could just store the data instead of finding a place for it to go.

#1 While theoretically possible, a dev responded and said basically that humans aren't that good at figuring out what processors should run our code so it's better if we let the computer handle it.

No, it's reserving memory that's off limits. Memory is No Humans Allowed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.