This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » Scratch script running at one hundred thousand iterations per second

#1 2012-01-12 18:29:37

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

Scratch script running at one hundred thousand iterations per second

Yeah. I made a program that can open a counter project (it counts from 1 to 100000) in a second.

Random screenshot of input.

What do you think?


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

Offline

 

#2 2012-01-12 18:52:12

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Scratch script running at one hundred thousand iterations per second

MathWizz wrote:

Yeah. I made a program that can open a counter project (it counts from 1 to 100000) in a second.

Random screenshot of input.

What do you think?

Maybe post some code or the Scratch script?  smile

Offline

 

#3 2012-01-13 10:17:40

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

MathWizz wrote:

Yeah. I made a program that can open a counter project (it counts from 1 to 100000) in a second.

Random screenshot of input.

What do you think?

I made some time ago a thing called "Fast Java player" it countes in 1 second to 1 000 000
big_smile


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

#4 2012-01-13 10:38:00

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

Re: Scratch script running at one hundred thousand iterations per second

ZeroLuck wrote:

MathWizz wrote:

Yeah. I made a program that can open a counter project (it counts from 1 to 100000) in a second.

Random screenshot of input.

What do you think?

I made some time ago a thing called "Fast Java player" it countes in 1 second to 1 000 000
big_smile

And that was in Java... 0.o I thought C# was faster. I will have to look at your execution code and see if mine is poorly optimized.  tongue


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

Offline

 

#5 2012-01-13 10:47:17

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

MathWizz wrote:

And that was in Java... 0.o I thought C# was faster. I will have to look at your execution code and see if mine is poorly optimized.  tongue

Java isn't really slower than C or C#!
Why should it?


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

#6 2012-01-13 10:49:57

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

In terms of high level languages, C is probably the fastest (if properly done) although if you wanted to be ultra fast, you could code it in assembly  big_smile


http://i.imgur.com/zeIZW.png

Offline

 

#7 2012-01-13 10:57:50

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

rookwood101 wrote:

In terms of high level languages, C is probably the fastest (if properly done) although if you wanted to be ultra fast, you could code it in assembly  big_smile

No.
You can't say "everything which is programmed in high level languages or assembly is fast" !
If you don't know much assembly your program would be probably slower than C.
If you write something bad (like a primfactor programm) your programm will be much slower than a optimized JavaScript script!

Last edited by ZeroLuck (2012-01-13 10:58:43)


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

#8 2012-01-13 11:24:34

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Scratch script running at one hundred thousand iterations per second

you didn't blur your name, just in case you didn't want people to know you real name  wink


http://i.imgur.com/1QqnHxQ.png

Offline

 

#9 2012-01-13 11:35:04

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

Re: Scratch script running at one hundred thousand iterations per second

ZeroLuck wrote:

MathWizz wrote:

And that was in Java... 0.o I thought C# was faster. I will have to look at your execution code and see if mine is poorly optimized.  tongue

Java isn't really slower than C or C#!
Why should it?

C is compiled into machine code. C# is compiled into byte code (am I right?) then compiled again at runtime. Java is just compiled into byte code. I haven't read much about this, but I think I am right...

TRocket wrote:

you didn't blur your name, just in case you didn't want people to know you real name  wink

Oh mai... Forgot about that.  tongue

Last edited by MathWizz (2012-01-13 11:36:05)


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

Offline

 

#10 2012-01-13 11:44:32

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

MathWizz wrote:

C is compiled into machine code. C# is compiled into byte code (am I right?) then compiled again at runtime. Java is just compiled into byte code. I haven't read much about this, but I think I am right...

I know.
Did you already compare the speed of a C program and the speed of a Java program?
I did...


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

#11 2012-01-13 12:59:57

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Scratch script running at one hundred thousand iterations per second

ZeroLuck wrote:

MathWizz wrote:

C is compiled into machine code. C# is compiled into byte code (am I right?) then compiled again at runtime. Java is just compiled into byte code. I haven't read much about this, but I think I am right...

I know.
Did you already compare the speed of a C program and the speed of a Java program?
I did...

therefore what I said was at least somewhat true, C is faster than java, as java has to be 'run twice'. Assembly code if well written should be the fastest, as it enables you to be essentially coding in machine code (although more readable), making it more efficient.

In order of fastest to slowest I would say it was:

Assembly, C, Java


http://i.imgur.com/zeIZW.png

Offline

 

#12 2012-01-13 18:15:03

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

Re: Scratch script running at one hundred thousand iterations per second

ZeroLuck wrote:

MathWizz wrote:

And that was in Java... 0.o I thought C# was faster. I will have to look at your execution code and see if mine is poorly optimized.  tongue

Java isn't really slower than C or C#!
Why should it?

C is usually faster than both Java and C#. C# can be faster than Java, but not necessarily.


nXIII

Offline

 
  • Index
  •  » Advanced Topics
  •  » Scratch script running at one hundred thousand iterations per second

Board footer