Re: Efficiently drawing of curved lines

35 views
Skip to first unread message

Lalit Pant

unread,
Apr 16, 2015, 7:07:01 AM4/16/15
to kojo...@googlegroups.com
Hmmm. On my (rather old!) machine (Intel Core 2 Duo CPU P8600  @ 2.40GHz with lots of RAM), your code runs in about 2 seconds. If I change setAnimationDelay from 10 to 0, it runs pretty much instantaneously.

My Kojo Version (this version is currently available on Kojo-Web):
2.4.06 r37 Build date: 16 Apr 2015

What kind of hardware are you on? What Kojo version are you using?

- Lalit

On Thu, Apr 16, 2015 at 3:18 PM, Christoph Knabe <kn...@beuth-hochschule.de> wrote:
I wrote a Kojo script, which draws a graph of the sine function.
It is awfully slow (about 40 seconds for the graph).
I suppose, that the graph is composed of 800 little line segments, which makes it so slow.
Is there a more efficient way to do it?

Christoph

--
You received this message because you are subscribed to the Google Groups "kojo-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kojo-user+unsubscribe@googlegroups.com.
To post to this group, send email to kojo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kojo-user/abfc700f-c05b-4ac2-9c83-bc6d1c220e68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lalit Pant

unread,
Apr 16, 2015, 11:49:40 PM4/16/15
to Christoph Knabe, kojo...@googlegroups.com
Any updates on this, Christoph?

I got similar results (~2 seconds with an animation delay of 10, and ~instantaneous with an animation delay of 0) with the current Kojo-Desktop release:
Kojo 2.4 Beta Version: 2.4.05 r14 Build date: 25 Feb 2015 Java version: 1.6.0_33-64bit. Scala version: 2.11.2

I had tried yesterday with:
Kojo 2.4 Beta Version: 2.4.06 r37 Build date: 16 Apr 2015 Java version: 1.8.0_20-32bit. Scala version: 2.11.6

The version infomation is from the Help->About window in Kojo.

- Lalit

On Thu, Apr 16, 2015 at 4:37 PM, Lalit Pant  wrote:
> Hmmm. On my (rather old!) machine (Intel Core 2 Duo CPU P8600  @ 2.40GHz with lots of RAM), your code runs in
> about 2 seconds. If I change setAnimationDelay from 10 to 0, it runs pretty much instantaneously.

> My Kojo Version (this version is currently available on Kojo-Web):
> 2.4.06 r37 Build date: 16 Apr 2015

> What kind of hardware are you on? What Kojo version are you using?

> - Lalit

Christoph Knabe

unread,
Apr 17, 2015, 4:56:19 AM4/17/15
to kojo...@googlegroups.com
Hi Lalit,

thanks for trying it.

Seems it really depends on the execution environment.
My slow running occurs on my development box: Lubuntu 14.04, 32bit in VirtualBox with 2 GiB RAM reserved for it and all 4 cores available for it.

When I run the same program in Kojo on the host computer (VirtualBox closed) it runs in the same speed as at you.
My host is a laptop ASUS UX31E with 4 cores i7-2677M @ 1.8 Ghz with 4 GiB RAM with Windows 7, 64bit.

Unfortunately the laptop after buying in 2012 did not succeed under Ubuntu with all monitors, beamers and HDMI switches I have to use and that is why I installed Ubuntu on top of the Windows system. Seems also not to be a good solution, but performance problems showed up only after 2 years.

Christoph


Am Donnerstag, 16. April 2015 13:07:01 UTC+2 schrieb Lalit Pant:
Hmmm. On my (rather old!) machine (Intel Core 2 Duo CPU P8600  @ 2.40GHz with lots of RAM), your code runs in about 2 seconds. If I change setAnimationDelay from 10 to 0, it runs pretty much instantaneously.

My Kojo Version (this version is currently available on Kojo-Web):
2.4.06 r37 Build date: 16 Apr 2015

What kind of hardware are you on? What Kojo version are you using?

- Lalit
On Thu, Apr 16, 2015 at 3:18 PM, Christoph Knabe <kn...@beuth-hochschule.de> wrote:
I wrote a Kojo script, which draws a graph of the sine function.
It is awfully slow (about 40 seconds for the graph).
I suppose, that the graph is composed of 800 little line segments, which makes it so slow.
Is there a more efficient way to do it?

Christoph

--
You received this message because you are subscribed to the Google Groups "kojo-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kojo-user+...@googlegroups.com.

Lalit Pant

unread,
Apr 17, 2015, 12:00:54 PM4/17/15
to Christoph Knabe, kojo...@googlegroups.com
Interesting.

I tried this with a couple of VirtualBox VMs on my machine:
- Win XP (~4 seconds with animation delay of 10; ~instantaneous with animation delay of 0)
- Linux Mint 13 (~22 seconds with animation delay of 10; ~instantaneous with animation delay of 0)

So there's a definite slowdown with Linux running on VirtualBox when we have a non-zero animation delay. But it seems to work fine when we go full speed with no animation delay.

- Lalit



Christoph Knabe

unread,
Apr 17, 2015, 4:03:38 PM4/17/15
to kojo...@googlegroups.com, kn...@beuth-hochschule.de
Really interesting.

When I run the code on my Lubuntu on VirtualBox with delays 0..4, it draws immediately.
When using delay of 5, the whole drawing needs about 40 seconds.

I already had some strange effect with VirtualBox, timers and Linux guests. Debian guest occupied each CPU given to it by 100%. It was said, that this is caused by inefficient timer interrupt handling. That is why I had to migrate my VB guest to Lubuntu (in fact minimal Ubuntu server with Ubuntu-VB guest additions and LXDE). There was a long discussion about tickless Linux kernels, which are specifically optimized to run on virtual machines.
 

Christoph Knabe

unread,
Apr 21, 2015, 4:11:33 AM4/21/15
to kojo...@googlegroups.com, kn...@beuth-hochschule.de
Update:
Testing on our virtual Windows Terminal Server in the university lab with setAnimationDelay(10) it also runs quickly in about 2 seconds.
So not every virtualization platform will slow it down.
Christoph
Reply all
Reply to author
Forward
0 new messages