Discuss Scratch

undeterministic
Scratcher
500+ posts

how many blocks of code is too much for scratch to store.

i am making a project that will probably have 50000 blocks of code. is this too much?
-OctoSquid-
Scratcher
100+ posts

how many blocks of code is too much for scratch to store.

Short answer: Most likely
Long answer: This post
___Jax
Scratcher
100+ posts

how many blocks of code is too much for scratch to store.

undeterministic wrote:

i am making a project that will probably have 50000 blocks of code. is this too much?
if its still under 5mb(i think thats the number) than yes me thinks
BigNate469
Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

___Jax wrote:

undeterministic wrote:

i am making a project that will probably have 50000 blocks of code. is this too much?
if its still under 5mb(i think thats the number) than yes me thinks
Yeah, that's true- for the project.json file, for other assets, it's 10MB maximum, thus there are projects that are over a gigabyte in total size. You might want to delete unused sounds, since they actually take up quite a bit of space in the project.json file, and for each deleted sound you could get like three blocks in.
horizontal_shading
Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

The limit is 10 MB for costumes and sounds, and 50 MB for the whole project, I think.
So probably a few ten thousand blocks
GlitchedThrough
New Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

horizontal_shading wrote:

and 50 MB for the whole project, I think.
There’s no maximum limit
BigNate469
Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

horizontal_shading wrote:

The limit is 10 MB for costumes and sounds, and 50 MB for the whole project, I think.
So probably a few ten thousand blocks
It used to be 50MB in 2.0, now, there can be projects well over a gigabyte- at some point, the project takes ages to save and load, so it becomes impractical to make it any larger.
___Jax
Scratcher
100+ posts

how many blocks of code is too much for scratch to store.

GlitchedThrough wrote:

horizontal_shading wrote:

and 50 MB for the whole project, I think.
There’s no maximum limit
but there is, its a file size limit, at least thats what I remember reading. its 50mb (tbh I thought it was 5mb Xb) in total me thinks
BigNate469
Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

___Jax wrote:

GlitchedThrough wrote:

horizontal_shading wrote:

and 50 MB for the whole project, I think.
There’s no maximum limit
but there is, its a file size limit, at least thats what I remember reading. its 50mb (tbh I thought it was 5mb Xb) in total me thinks
See my above comment. The project.json file must be under 5MB, any asset must be under 10MB, there is no total size limit.
___Jax
Scratcher
100+ posts

how many blocks of code is too much for scratch to store.

BigNate469 wrote:

___Jax wrote:

GlitchedThrough wrote:

horizontal_shading wrote:

and 50 MB for the whole project, I think.
There’s no maximum limit
but there is, its a file size limit, at least thats what I remember reading. its 50mb (tbh I thought it was 5mb Xb) in total me thinks
See my above comment. The project.json file must be under 5MB, any asset must be under 10MB, there is no total size limit.
srry ^^"
ajskateboarder
Scratcher
1000+ posts

how many blocks of code is too much for scratch to store.

undeterministic wrote:

i am making a project that will probably have 50000 blocks of code. is this too much?
50,000 blocks (likely) cannot be stored in a project online

The average size of one standard JSON block statement with default parameters is 0.2kb. Multiply that by 50,000 and the total size reaches 10mb… too much! TurboWarp can reduce the JSON size by 2mb (bumping down the average block statement size by 0.04kb), but alas, this is still too much JSON to satisfy Scratch

(
import json
project = json.loads("project.json string")
blocks = [] 
for sprite in project["targets"]:
    if sprite["blocks"]:
        for k, b in sprite["blocks"].items():
            blocks.append((len("\"" + k + "\": " + str(json.dumps(b).encode("utf-8"))) / 1000))
print(mean(blocks) / 1000, "kb")
print((mean(blocks) * 50000) / 1000, "kb")
)

Last edited by ajskateboarder (May 9, 2024 13:51:34)

Powered by DjangoBB