Discuss Scratch

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)

ideapad-320
Scratcher
1000+ posts

How much space does a scratch block take up?

bytes.
hi875230163394
Scratcher
1000+ posts

How much space does a scratch block take up?

NFlex23 wrote:

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?

hi875230163394 wrote:

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
I 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.
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?

MoosenMooALot wrote:

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):
{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
This is 117 bytes (Including the comma, and excluding the outside brackets) per block.
Geotale
Scratcher
100+ posts

How much space does a scratch block take up?

MoosenMooALot wrote:

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.
Where did you get these counts? It's most definitely not possible to have blocks these small in the JSON
ideapad-320
Scratcher
1000+ posts

How much space does a scratch block take up?

MoosenMooALot wrote:

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.
the size needed is uncompressed.
hi875230163394
Scratcher
1000+ posts

How much space does a scratch block take up?

completeness wrote:

hi875230163394 wrote:

NFlex23 wrote:

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)
There are multiple projects with over 25,000 blocks.
that number has been disproved
hi875230163394
Scratcher
1000+ posts

How much space does a scratch block take up?

Geotale wrote:

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):
{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
This is 117 bytes (Including the comma, and excluding the outside brackets) per block.
im not sure about that, because it may take up extra space to enable the exstension
hi875230163394
Scratcher
1000+ posts

How much space does a scratch block take up?

completeness wrote:

hi875230163394 wrote:

completeness wrote:

hi875230163394 wrote:

NFlex23 wrote:

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)
There are multiple projects with over 25,000 blocks.
that number has been disproved
You're right, I was mistaken, but there are projects with over 20,000 blocks.
194,180 > 20,000

(not to mention thats uncompressed)
dhuls
Scratcher
1000+ posts

How much space does a scratch block take up?

hi875230163394 wrote:

(#17)

completeness wrote:

hi875230163394 wrote:

completeness wrote:

hi875230163394 wrote:

NFlex23 wrote:

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)
There are multiple projects with over 25,000 blocks.
that number has been disproved
You're right, I was mistaken, but there are projects with over 20,000 blocks.
194,180 > 20,000

(not to mention thats uncompressed)
Note that Scratch only cares about the uncompressed size, since the project.json is store uncompressed on the server
Geotale
Scratcher
100+ posts

How much space does a scratch block take up?

hi875230163394 wrote:

Geotale wrote:

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):
{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
This is 117 bytes (Including the comma, and excluding the outside brackets) per block.
im not sure about that, because it may take up extra space to enable the exstension
When trying to get as many blocks in as possible, that will decrease the count by probably one block at max
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.
"Ik0EU^L/Sd5iz@HL$;Da":[12,"y","k{s7LLVj|8}_|Q{jdoEg",0,0]
The data for a looks show/hide block takes up 139 characters or 139 bytes.
"q*1d)lKQ#eG9Dh|JKo-6":{"opcode":"looks_show","next":null,"parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":0,"y":0}
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.
hi875230163394
Scratcher
1000+ posts

How much space does a scratch block take up?

Geotale wrote:

hi875230163394 wrote:

Geotale wrote:

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):
{"a":{"opcode":"pen_penUp","next":"b","parent":"c","inputs":{},"fields":{},"shadow":true,"topLevel":true,"x":0,"y":0}}
This is 117 bytes (Including the comma, and excluding the outside brackets) per block.
im not sure about that, because it may take up extra space to enable the exstension
When trying to get as many blocks in as possible, that will decrease the count by probably one block at max
Good point, let's do the math: 42,734 blocks max (subtracting the 1 block worth of data needed for adding the extension)
Maximouse
Scratcher
1000+ posts

How much space does a scratch block take up?

hi875230163394 wrote:

im not sure about that, because it may take up extra space to enable the exstension
Scratch finds which extensions are used based on the block opcodes.

Powered by DjangoBB