This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#7976 2013-04-17 07:36:25

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Zygorithm wrote:

Are there any gigantic performance leaps planned?

Async will make it so it doesn't totally crash when it tries to load giant projects, but it probably won't get that much faster (I'm not sure, though—it depends how optimized the code is right now).

Hardmath123 wrote:

I wonder how Scratch gets it so fast—I'm guessing (as n said) they use asynchronous loading.

They use Squeak, which can do manual world cycles inside of long-running scripts, so they just do a few of those. They also don't have to convert image and sound data to a different format.


nXIII

Offline

 

#7977 2013-04-17 10:54:15

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Async will make it so it doesn't totally crash when it tries to load giant projects, but it probably won't get that much faster (I'm not sure, though—it depends how optimized the code is right now).

Asynchronous loading can affect the user's perception of speed, but it does nothing to change the actual time requirement.  So it works (subjectively) when the loading time is dominated by the running time and can be spread out thinly over the latter.  When the user's experience is dominated by loading time, async won't help at all.  I suppose one could try to take advantage of multicore processors by having the loading and running truly in parallel.

It's still a worthy effort, not for gargantuan projects, but to help me convince Jens to import the tool library all the time on startup.  smile

Gargantuan projects shouldn't crash, though.  By all means please find and fix whatever's causing that.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7978 2013-04-17 17:51:44

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

@Hardmath123 how did you get my project successfully running on sb2.js?
I'm using the sb2.js javascript viewer and it just sits there all day trying to load the project.

Offline

 

#7979 2013-04-17 20:44:35

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

JS is single-threaded (I'm ignoring web workers because we don't use them), so when the serializer is running, user input is neither received nor handled and the display is never updated. Loading asynchronously would mean that we could continue receiving user input and updating the display (and allowing the browser to run its UI for non-multi-process browsers) while the serializer ran. It would do very little to change the load time (it might make it a tiny bit slower because each morphic.js display cycle takes some processing power), but would give the user a sense of the elapsed and remaining time as well as the total progress, and make Snap! feel more responsive.

I also said that if I made the (de)serializer asynchronous I'd rewrite it from scratch with speed as the primary concern, which could make it substantially faster.

To this end, I need some reasonably large projects which load in the current serializer, as well as some that fail to load due to errors and some that hang Snap! indefinitely. Contributions would be greatly appreciated  smile


nXIII

Offline

 

#7980 2013-04-18 10:57:40

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Anyone got any idea why i'm getting this error message?
http://i.imgur.com/ixhNiuf.png
I'm writing a text-based Snap! language in JS based on the [scratchblocks] syntax  smile


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#7981 2013-04-18 11:51:31

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

Anyone got any idea why i'm getting this error message?

Can you post the raw JS file? Much easier to debug that way.  tongue

You could also try JSLint; I sometimes find that a different error message, that helps find the problem.

I'm writing a text-based Snap! language in JS based on the [scratchblocks] syntax  smile

Cool!

Last edited by blob8108 (2013-04-18 11:51:57)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7982 2013-04-18 12:10:42

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Missing semicolon at end of line 30?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#7983 2013-04-18 12:13:35

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Missing semicolon at end of line 30?

One of the most common reasons for a program not functioning: A missing semicolon.  tongue

Last edited by nathanprocks (2013-04-18 12:13:53)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#7984 2013-04-18 12:19:14

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Missing semicolon at end of line 30?

There, hardmath spotted it! I was going crazy looking at the tiny text  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7985 2013-04-18 12:20:29

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Look what I found: westley.c. It makes my mind boggle just looking at it.  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7986 2013-04-18 13:53:57

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nathanprocks wrote:

Hardmath123 wrote:

Missing semicolon at end of line 30?

One of the most common reasons for a program not functioning: A missing semicolon.  tongue

Also another reason I use Python. Semicolons are irritating for many reasons.  tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#7987 2013-04-18 14:03:21

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

another reason I use Python. Semicolons are irritating

Python has semicolons too, you know...  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7988 2013-04-18 14:43:40

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

technoboy10 wrote:

another reason I use Python. Semicolons are irritating

Python has semicolons too, you know...  tongue

Yes, but not as many as C.  smile


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#7989 2013-04-18 16:22:27

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

Anyone got any idea why i'm getting this error message?
http://i.imgur.com/ixhNiuf.png
I'm writing a text-based Snap! language in JS based on the [scratchblocks] syntax  smile

FYI lines 23-30 can be replaced with something like this:

Code:

code = code.replace(/([:)>\]] )([<>])( [:(<\[])/g, function (_, left, sign, right) { // Woo, regex emoticons
    return left + (sign === '<' ? '&lt;' : '&gt;') + right;
});

(if you need dynamic regexes, the constructor is RegExp, not regExp)

Also, use forEach instead of for…in for looping through arrays (for…in is for objects, and even then it has problems [and even the solutions to those problems have problems]).

Last edited by nXIII (2013-04-18 16:28:30)


nXIII

Offline

 

#7990 2013-04-19 11:14:52

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Missing semicolon at end of line 30?

Ah, thanks! it works now!

I'll share it as soon as i've written up the syntax and examples  smile


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#7991 2013-04-19 11:39:54

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

@Hardmath I took another look at the giant xml file, and here are two few things that might help with the size of files that snapin8r generates:
- Don't pretty-print the XML. Whitespace alone accounts for 903,240 characters in that file (over 5% of the 17,424,524 total)
- base64-encode images rather than url-encoding them—it's much more efficient


nXIII

Offline

 

#7992 2013-04-19 11:59:02

arr20
New Scratcher
Registered: 2013-04-19
Posts: 1

Re: BYOB 3 - Discussion Thread

I´m comunicating with a robot using the BYOB. The robot sends sensors' information and BYOB returns actions to the motors. But, when I use blocks that I've created to control de motor, using sensors values as conditions, the BYOB doesn´t atualize the sensors' values in the same speed that when I send them to BYOB. In this way I have a huge delay in the action of the motors. I think it´s because when the BYOB decodifies the mensage, with sensor's values, it takes a big delay.

Any suggestions of what can I do?
Does anyone had this problem?

Offline

 

#7993 2013-04-19 16:50:39

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

blob8108 wrote:

should I submit a github pull request?  tongue

Sure!  Just don't put any colon-Ps in the code or Jens will get mad...

tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7994 2013-04-19 16:58:50

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Question: Is coding late into the night a good idea?  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7995 2013-04-19 17:20:30

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Question: Is coding late into the night a good idea?  tongue

Depends, what're you programming?


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#7996 2013-04-19 17:27:07

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

blob8108 wrote:

Question: Is coding late into the night a good idea?  tongue

Depends, what're you programming?

I just meant generally, as a kind of lifestyle thing...


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7997 2013-04-19 19:57:26

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Question: Is coding late into the night a good idea?  tongue

If you have school, it's a really bad idea. Otherwise, go ahead (but beware of awkward family situations  tongue ).


nXIII

Offline

 

#7998 2013-04-19 20:29:07

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: BYOB 3 - Discussion Thread

This is really random, but I thought it would be a fun test.

‮I'm writing backwards.  tongue


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#7999 2013-04-19 21:10:33

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Question: Is coding late into the night a good idea?  tongue

It depends how important it is that your code actually work.  Teams building life-critical software typically require programmers to quit work and go home at 5pm like normal people.  On the other hand, if you're building the first prototype of some new idea, banging away at it round the clock for three days can foster great creativity, I think.

A friend of mine in college once decided to live on a 28-hour day because 28*6=24*7 and by rotating phase he'd be awake at the same time as each of his friends at least once in the week.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#8000 2013-04-19 21:16:33

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

If you have school, it's a really bad idea.

Only if you intend to attend classes.  tongue   (Don't tell your parents I said that.)

But I can attest that it is a bad idea to stay up for 72 hours and then go to a class and sit in the front row.  (I wasn't always as sensible as I am today.)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

Board footer