Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » How much space does a scratch block take up?
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
Ok so, how much space does one scratch block take up (assuming we are using the scratch block that takes up the smallest amount of space of course) so we can answer the ultimate question: how many blocks can a scratch project have
- IDontNoWatIAm
-
Scratcher
500+ posts
How much space does a scratch block take up?
The smallest file size block would probably be one that doesn't take much text for scratch to recognize, but I'm not really sure which one. another thing might be that blocks that don't have inputs could take up less space since they don't need to have an input container. That's all the theories I have anyway since I don't wanna go make and open project.jsons for each scratch block.
- NFlex23
-
Scratcher
1000+ posts
How much space does a scratch block take up?
A single “move 10 steps” block has a size of 169 bytes, at least according to a test I just did. However, a “move _ steps” block only has one input, so it wouldn't be very accurate to multiple 169 by the amount of blocks in a project.
Last edited by NFlex23 (March 21, 2022 20:00:43)
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
A single “move 10 steps” block has a size of 169 bytes, at least according to a test I just did. However, a “move _ steps” block only has one input, so it wouldn't be very accurate to multiple 169 by the amount of blocks in a project.If this is true, assuming scratch uses binary, than the total number of blocks you can put in a project is 31022 (but realistically, who needs that many)
- MoosenMooALot
-
Scratcher
89 posts
How much space does a scratch block take up?
Ok so, how much space does one scratch block take up (assuming we are using the scratch block that takes up the smallest amount of space of course) so we can answer the ultimate question: how many blocks can a scratch project haveI think it definitely depends on the block, but I will look into it to see some byte amounts per block.
- MoosenMooALot
-
Scratcher
89 posts
How much space does a scratch block take up?
27 bytes per move 10 steps block.
27 bytes per turn 15 degrees block.
55 bytes per glide 1 second to random position block.
27 bytes per if on edge, bounce block.
27 bytes per say hello for 2 seconds block.
55 bytes for each switch costume to costume 1 block.
27 bytes for each clear graphic effects block.
55 bytes for each play sound pop until done block.
22 bytes for each when flag clicked block.
27 bytes for each wait 1 second block.
26 bytes for each if then else block.
55 bytes for each create clone of myself block.
27 bytes for each reset time block.
27 bytes for each 1+1 block.
That's all I have time to test, but I hope that helps you to better understand block size! Basically, they take up very little. Most file size comes from costumes, based on their complexity.
27 bytes per turn 15 degrees block.
55 bytes per glide 1 second to random position block.
27 bytes per if on edge, bounce block.
27 bytes per say hello for 2 seconds block.
55 bytes for each switch costume to costume 1 block.
27 bytes for each clear graphic effects block.
55 bytes for each play sound pop until done block.
22 bytes for each when flag clicked block.
27 bytes for each wait 1 second block.
26 bytes for each if then else block.
55 bytes for each create clone of myself block.
27 bytes for each reset time block.
27 bytes for each 1+1 block.
That's all I have time to test, but I hope that helps you to better understand block size! Basically, they take up very little. Most file size comes from costumes, based on their complexity.
- MoosenMooALot
-
Scratcher
89 posts
How much space does a scratch block take up?
So basically, most blocks take up either 27 bytes or so, or double that, depending on the detail of the function.
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
So basically, most blocks take up either 27 bytes or so, or double that, depending on the detail of the function.if this math is true, then the new maximum amount of blocks in one project (assuming all of the blocks are unmodified move 10 steps blocks) is 194180
- Geotale
-
Scratcher
100+ posts
How much space does a scratch block take up?
I'm betting the pen_penUp block is the smallest, and it has no inputs or fields, so it would be able to fit the most.
Assuming the project is minified, here's the shortest block I could come up with (though I don't know what Scratch does or doesn't detect as illegal – This is a topLevel block with a previous block somehow, for example):
This is 117 bytes (Including the comma, and excluding the outside brackets) per block.
Assuming the project is minified, here's the shortest block I could come up with (though I don't know what Scratch does or doesn't detect as illegal – This is a topLevel block with a previous block somehow, for example):
{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
- Geotale
-
Scratcher
100+ posts
How much space does a scratch block take up?
27 bytes per move 10 steps block.Where did you get these counts? It's most definitely not possible to have blocks these small in the JSON
27 bytes per turn 15 degrees block.
55 bytes per glide 1 second to random position block.
27 bytes per if on edge, bounce block.
27 bytes per say hello for 2 seconds block.
55 bytes for each switch costume to costume 1 block.
27 bytes for each clear graphic effects block.
55 bytes for each play sound pop until done block.
22 bytes for each when flag clicked block.
27 bytes for each wait 1 second block.
26 bytes for each if then else block.
55 bytes for each create clone of myself block.
27 bytes for each reset time block.
27 bytes for each 1+1 block.
That's all I have time to test, but I hope that helps you to better understand block size! Basically, they take up very little. Most file size comes from costumes, based on their complexity.
- ideapad-320
-
Scratcher
1000+ posts
How much space does a scratch block take up?
27 bytes per move 10 steps block.the size needed is uncompressed.
27 bytes per turn 15 degrees block.
55 bytes per glide 1 second to random position block.
27 bytes per if on edge, bounce block.
27 bytes per say hello for 2 seconds block.
55 bytes for each switch costume to costume 1 block.
27 bytes for each clear graphic effects block.
55 bytes for each play sound pop until done block.
22 bytes for each when flag clicked block.
27 bytes for each wait 1 second block.
26 bytes for each if then else block.
55 bytes for each create clone of myself block.
27 bytes for each reset time block.
27 bytes for each 1+1 block.
That's all I have time to test, but I hope that helps you to better understand block size! Basically, they take up very little. Most file size comes from costumes, based on their complexity.
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
that number has been disprovedThere are multiple projects with over 25,000 blocks.A single “move 10 steps” block has a size of 169 bytes, at least according to a test I just did. However, a “move _ steps” block only has one input, so it wouldn't be very accurate to multiple 169 by the amount of blocks in a project.If this is true, assuming scratch uses binary, than the total number of blocks you can put in a project is 31022 (but realistically, who needs that many)
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
I'm betting the pen_penUp block is the smallest, and it has no inputs or fields, so it would be able to fit the most.im not sure about that, because it may take up extra space to enable the exstension
Assuming the project is minified, here's the shortest block I could come up with (though I don't know what Scratch does or doesn't detect as illegal – This is a topLevel block with a previous block somehow, for example):This is 117 bytes (Including the comma, and excluding the outside brackets) per block.{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
194,180 > 20,000You're right, I was mistaken, but there are projects with over 20,000 blocks.that number has been disprovedThere are multiple projects with over 25,000 blocks.A single “move 10 steps” block has a size of 169 bytes, at least according to a test I just did. However, a “move _ steps” block only has one input, so it wouldn't be very accurate to multiple 169 by the amount of blocks in a project.If this is true, assuming scratch uses binary, than the total number of blocks you can put in a project is 31022 (but realistically, who needs that many)
(not to mention thats uncompressed)
- dhuls
-
Scratcher
1000+ posts
How much space does a scratch block take up?
(#17)Note that Scratch only cares about the uncompressed size, since the project.json is store uncompressed on the server194,180 > 20,000You're right, I was mistaken, but there are projects with over 20,000 blocks.that number has been disprovedThere are multiple projects with over 25,000 blocks.A single “move 10 steps” block has a size of 169 bytes, at least according to a test I just did. However, a “move _ steps” block only has one input, so it wouldn't be very accurate to multiple 169 by the amount of blocks in a project.If this is true, assuming scratch uses binary, than the total number of blocks you can put in a project is 31022 (but realistically, who needs that many)
(not to mention thats uncompressed)
- Geotale
-
Scratcher
100+ posts
How much space does a scratch block take up?
When trying to get as many blocks in as possible, that will decrease the count by probably one block at maxI'm betting the pen_penUp block is the smallest, and it has no inputs or fields, so it would be able to fit the most.im not sure about that, because it may take up extra space to enable the exstension
Assuming the project is minified, here's the shortest block I could come up with (though I don't know what Scratch does or doesn't detect as illegal – This is a topLevel block with a previous block somehow, for example):This is 117 bytes (Including the comma, and excluding the outside brackets) per block.{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
- imfh
-
Scratcher
1000+ posts
How much space does a scratch block take up?
The data for a variable reporter with a single letter for it's name takes up 58 characters or 58 bytes.
The data for a looks show/hide block takes up 139 characters or 139 bytes.
Note that both of these were at the location 0 0 in the code area, and had no parent block or next block. This also did not include the comma or space required to hold the variable definition.
"Ik0EU^L/Sd5iz@HL$;Da":[12,"y","k{s7LLVj|8}_|Q{jdoEg",0,0]"q*1d)lKQ#eG9Dh|JKo-6":{"opcode":"looks_show","next":null,"parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":0,"y":0}- hi875230163394
-
Scratcher
1000+ posts
How much space does a scratch block take up?
Good point, let's do the math: 42,734 blocks max (subtracting the 1 block worth of data needed for adding the extension)When trying to get as many blocks in as possible, that will decrease the count by probably one block at maxI'm betting the pen_penUp block is the smallest, and it has no inputs or fields, so it would be able to fit the most.im not sure about that, because it may take up extra space to enable the exstension
Assuming the project is minified, here's the shortest block I could come up with (though I don't know what Scratch does or doesn't detect as illegal – This is a topLevel block with a previous block somehow, for example):This is 117 bytes (Including the comma, and excluding the outside brackets) per block.{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
- Maximouse
-
Scratcher
1000+ posts
How much space does a scratch block take up?
im not sure about that, because it may take up extra space to enable the exstensionScratch finds which extensions are used based on the block opcodes.
- Discussion Forums
- » Advanced Topics
-
» How much space does a scratch block take up?