Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Graph Drawing & /View Performance

 [1/21] from: chris:langreiter at: 6-May-2002 20:22


I've spent most of today with porting the algorithm behind the fantastic TouchGraph applet (http://www.touchgraph.com) to REBOL/View. Originally I intended only to output the node coordinates after, say, 1000 iterations to handle final display to Flash or whatever. http://www.langreiter.com/rebol/txrx/txrx-1.r Just to make sure everything was okay I visualized the result with REBOL/View, and - shock! - was just amazed at how fast it was (I've also ported the algorithm to Flash/ActionScript - it's pretty much impossible to increase the number of nodes to over 15 or even 20 - REBOL/View seems to be a whole lot faster). But then, when I tried to figure out a way to implement edge drawing, all my /Viewnduced happiness came tumbling down. I can't seem to figure out a way to _quickly_ (REALLY quickly) draw lines in /View. My first naive attempts involved the effect facet and the Draw Dialect, but performance was just - horrendous. The best thing I can come up with is creating and setting images as often as needed, but there _must_ be a better (i.e. faster) way ... Some way that allows me to directly act upon an existing image. f/image/clear f/image/line 200x200 150x300 Comment the line "f/image: to-image edge-layout" to see how fast node layouting is with edge drawing turned off. I hope one of the Masters of /View can guide me through this semi-documented dark cave of poor performance. Otherwise, enjoy ;-) -- Chris -- http://www.langreiter.com

 [2/21] from: petr:krenzelok:trz:cz at: 7-May-2002 0:02


Hello Christian, Christian Langreiter wrote:
>I've spent most of today with porting the algorithm behind the >fantastic TouchGraph applet (http://www.touchgraph.com) to
<<quoted lines omitted: 7>>
>impossible to increase the number of nodes to over 15 or even 20 - >REBOL/View seems to be a whole lot faster).
Well, I tried Cyphre's Arcadia game engine. It gives me some 14 - 16fps on 1280x1024 display, on my Athlon 1.4 GHz :-) Cyphre uses final composition into draw block - so View just uses draw dialect to place all the objects into final scene, going for refresh, if I understand it correctly ... OTOH I also remember Cyphre's comments re 'draw painfull slowness in some situations, and also not so well finished feature set. Compromises can be found on various places. I think it needs to be adressed, or View will stay limited. It is good engine, it just needs some changes/additions, as: - ability to hide mouse and replace it by nested faces (somewhere in system structure) for kiosk systems - ability to have transparent top most face? - rotate effect - effect for alpha channel (gradient to alpha channel etc.) - simultaneous key-presses - MUCH better sound support ... I only saw Olivier's game and it is not usable with sound at all ... - IIRC it was said View uses internally some math engine to generate effects (convolution?) (used for blur) ... if it could be used for fast user custom effects, it should be exposed to the language level (I remember Holger stating it will not become RT's priority, unless there is business side interest :-( ... at least we know something like that is possible) ... or at least change-each with custom dialect (Core 2.6 will introduce remove-each series [dialect here ...]) - removing timeouts without hiding a face thru face/changes ... - ability to produce events (if achievable in cross platform manner) Well, we know what comes for Core 2.6 (at least partially), maybe RT could tell us, what is planned for View 1.3? Is it only a few changes to VID? At least some View kernel changes could be introduced, to allow some of us boost their activities in respective areas ... Cheers, -pekr-

 [3/21] from: larry:ecotope at: 6-May-2002 16:15


> The best thing I can come up with is creating and setting images as > often as needed, but there _must_ be a better (i.e. faster) way ... > Some way that allows me to directly act upon an existing image. > > f/image/clear > f/image/line 200x200 150x300
Hi Christian, You might be able to use my drawline algorithm which uses the method of Bresenham to draw lines on an image. It is the fastest algorithm I was able to come up with. http://www.nwlink.com/~ecotope1/reb/draw-line2.r -Larry

 [4/21] from: greggirwin:mindspring at: 6-May-2002 17:09


Hi Chris, Cool stuff! I've seen similar performance issues myself. The size of the face you're refreshing has a lot to do with it. Try changing your big faces to 500x300 and see how fast it goes. --Gregg

 [5/21] from: cyphre:seznam:cz at: 7-May-2002 13:14


Hi Christian, Nice script ;-) I haven't time to look into its guts but I'll try to find some improvements for better performance(if it will be possible) during the weekend... I thought that Rebol has slow math but while doing some speed tests I noticed that the most CPU power takes visualization. Relatime(with dynamic buffer ;-) ) calculating rotation of DRAW block containing 10 filled polygons around 360 degrees(with step of 1 degree) takes less than half second on Celeron 533Mhz...that could be theoreticaly about 600fps! but when you want to visualize it the performance goes down to about 15-20fps. (Watch the upcomming release of Rebol/Zine #6 where you can try the example script with such 2D vector DRAW buffered generator..) I always thought that rebol has slow math but now I see that the performance slowdown is in the visualisation part. I'm still dreaming about HW accelerated View port (OpenGL or DirectX)....I think that without hw accelerated graphics(at least on some Rebol ports where it is possible) we couldn't have even smooth 2D plain vectors. I wish RT would have time to wrap at least Windows and Xwin ports for such HW acceleration.... I believe there won't be any platform issues because you can write the same View code...The result would differ only in the rendering part of Rebol....on hw accelerated systems your code would fly! ;) regards, Cyphre

 [6/21] from: rotenca:telvia:it at: 7-May-2002 18:27


Hi, Christian
> f/image/clear > f/image/line 200x200 150x300 > > Comment the line "f/image: to-image edge-layout" to see how fast node > layouting is with edge drawing turned off.
I think you should use a dinamic draw block, to-image is too slow. Draw lines on a background face with something like effect: [draw [lines...] and change the effect at every frame. The clear of old lines comes for free, when you change the effect, you are deleting the old draw instructions. --- Ciao Romano

 [7/21] from: chris:langreiter at: 7-May-2002 21:54


#Bonjour Romano,
> I think you should use a dinamic draw block, to-image is too slow. > Draw lines on a background face with something like > effect: [draw [lines...] > and change the effect at every frame. The clear of old lines comes for free, > when you change the effect, you are deleting the old draw instructions.
Actually I have tried this solution, with the somehwat startling effect that it was probably the slowest variant of 'em all. the (cumbersome IMO) to-image method is way way faster. I'll now try Larry's Bresenham, though I've read somewhere that draw was supposed to be way faster (5x?). On va voir. The speed penalty seems to be introduced by the sheer existence of the 'effect' ... Something's weird here. -- Chris

 [8/21] from: rotenca:telvia:it at: 8-May-2002 2:33


Hi, Christian
> Actually I have tried this solution, with the somehwat startling > effect that it was probably the slowest variant of 'em all. the > (cumbersome IMO) to-image method is way way faster.
It seems very strange to me because you draw lines on a face before calling to-image, so to-image is time consuming. On the console (the code is messy) i have written this example which simulate your program: n: 0 x: make block! 3000 create: does [ n: n + 1 if n = 100 [unview] foreach x l/pane [ if x/size = 60x22 [ x/offset: random 500x500 ] ] clear x loop 500 [ insert x reduce ['line random 250x250 250x250 + random 250x250] ] x ] l: layout [ im: image 500x500 rate 0 white effect [] feel [ engage: func [f a e] [ f/effect: compose/deep [ draw [(create)] ] show l ] ] ] for i 1 150 1 [ append l/pane make-face/size/spec 'box 60x22 [ color: random 255.255.255 offset: random 500x500] ] view/new l t1: now/precise do-events t2: now/precise print [t2/time - t1/time n] and on a system with Celeron 333 Mhz and an old graphic card i have about 17 sec for moving 150 faces and drawing 500 lines 100 times --- Ciao Romano

 [9/21] from: chris:langreiter at: 8-May-2002 3:24


> and on a system with Celeron 333 Mhz and an old graphic card i have about 17 > sec for moving 150 faces and drawing 500 lines 100 times
Romano, MILLE GRAZIE! You gave me quite the hint I needed. http://www.langreiter.com/rebol/txrx/txrx-1c.r (The lapse I made before was that I had an "show f" in the node-face!'s engage function - there none was due. I probably have to reread the chapter in "/View in 21 Days" on where to put stuff like this - oh well ;-) Anyway, it works like a charm now! Enjoy! Best regards, -- Chris

 [10/21] from: brett:codeconscious at: 8-May-2002 17:24


> Anyway, it works like a charm now! Enjoy! > > Best regards, > -- Chris
Nice! :^) I let it loose on the master stylesheet too: raw-edges: copy [] foreach [name defn] svv/vid-styles [ append raw-nodes form name if 'face <> name [ append/only raw-edges reduce [ form name form get in defn 'style ] ] ] Regards, Brett.

 [11/21] from: rotenca:telvia:it at: 8-May-2002 21:46


Hi Christian,
> (The lapse I made before was that I had an "show f" in the > node-face!'s engage function - there none was due. I probably have to > reread the chapter in "/View in 21 Days" on where to put stuff like > this - oh well ;-)
I have tryed many show position/combination, also tryed hardware move with changes: 'offset, but show window in this case was the best solution (i do not know why). I do not think there is some good doc about show use, but if something is slow often the reason is a great number of (and often also duplicate) show calling. --- Ciao Romano

 [12/21] from: cyphre:seznam:cz at: 9-May-2002 15:13


Hi Romano and all,
>From my experience:
-use "show f" on each face when you need refresh small parts of window but don't use it when you need show lot of small faces -using one "show f" for whole window is better when you are controling more faces in the window at the same time...then you rather use 'redraw function in each small face instead of 'enagage you can see the performance difference in following examples: http://www.rebol.cz/~cyphre/draw-tutor-2orig.r - this script uses method of refreshing each object face separately http://www.rebol.cz/~cyphre/draw-tutor-2.r - this script uses method of one global 'show of the whole window area regards, Cyphre

 [13/21] from: etienne:alaurent:free at: 9-May-2002 22:15


Hi, Richard, I don't see any difference about exec speed between your 2 scripts. But, it's very interesting to know it's better to use one 'show for whole window than a 'show for every sub-face. Cyphre wrote:
>Hi Romano and all, >>From my experience:
<<quoted lines omitted: 50>>
>> >>
-- regards. --- Etienne

 [14/21] from: cyphre:seznam:cz at: 10-May-2002 9:24


Hi Etienne, ----- Original Message ----- From: "Etienne ALAURENT" <[etienne--alaurent--free--fr]> To: <[rebol-list--rebol--com]> Sent: Thursday, May 09, 2002 10:15 PM Subject: [REBOL] Re: Graph Drawing & /View Performance
> Hi, Richard, > > I don't see any difference about exec speed between your 2 scripts. > But, it's very interesting to know it's better to use one 'show for > whole window than a 'show for every sub-face. >
Well, you have probably very fast comupter ;-) I tried it on 533MhzCeleron and the http://www.rebol.cz/~cyphre/draw-tutor-2.r is at least is twice as faster than http://www.rebol.cz/~cyphre/draw-tutor-2orig.r If you want, try to increase the number of objects in this line in both scripts: pane: reduce join [game/my-tank ] array/initial 5 [game/cpu-tank] || the "5" is number of cpu-driven tanks regards, Cyphre

 [15/21] from: rebol665:ifrance at: 10-May-2002 13:30


Hi Etienne, I have been using a simplified version of your aquae-blue skin for a while. Are-you aware that it doesn't work properly with the 2.5.2 bÍta? Backdrops are not correctly displayed, buttons are squared ? Patrick

 [16/21] from: etienne:alaurent:free at: 10-May-2002 17:18


Hi, Patrick, I know these problems. I think the new View engine is the same as the Link one. So, I made many changes for Link, and it seems to be ok. But I want to test it before publishing it. So, as soon as the official View version is online, I'll put the new skins version online too. pat665 wrote:
>Hi Etienne, > >I have been using a simplified version of your aquae-blue skin for a while. >Are-you aware that it doesn't work properly with the 2.5.2 b=EAta? Backdrops >are not correctly displayed, buttons are squared ? > >Patrick >
-- regards. --- Etienne

 [17/21] from: rebol665:ifrance at: 11-May-2002 10:46


Hi Etienne, I see your point however the View 2.5.2 is released now. May be you could share what you have learned about the new view with the list ? Patrick ----- Original Message ----- From: "Etienne ALAURENT" <[etienne--alaurent--free--fr]> To: <[rebol-list--rebol--com]> Sent: Friday, May 10, 2002 5:18 PM Subject: [REBOL] Re: Graph Drawing & /View Performance Hi, Patrick, I know these problems. I think the new View engine is the same as the Link one. So, I made many changes for Link, and it seems to be ok. But I want to test it before publishing it. So, as soon as the official View version is online, I'll put the new skins version online too. pat665 wrote:
>Hi Etienne, > >I have been using a simplified version of your aquae-blue skin for a while. >Are-you aware that it doesn't work properly with the 2.5.2 bÍta? Backdrops >are not correctly displayed, buttons are squared ? > >Patrick >
-- regards. --- Etienne

 [18/21] from: etienne:alaurent:free at: 12-May-2002 3:14


Hi, Pat, I thought this View version was a beta release ... What can I share ... ? I can say I discovered two new widgets : drop-down and scroller (witch derives from slider + 2 arrow buttons). The slider's code and feel are not the same as in the previous version. If you used a derived widget, it could not run now. The transparency is hard to understand without doc. The first difference I saw between the 2 versions is that to make a face transparent you must set its 'color to none. I noticed in View 1.2.1 it was not obligatory. An other thing : if your script runs well on the new version, it will run well on the previous one (I test this everyday). I didn't notice other thing particular. pat665 wrote:
>Hi Etienne, >I see your point however the View 2.5.2 is released now. May be you could
<<quoted lines omitted: 34>>
>vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... >http://www.ifrance.com/_reloc/email.emailif
-- regards. --- Etienne

 [19/21] from: g:santilli:tiscalinet:it at: 12-May-2002 12:13


Hi Etienne, On Sunday, May 12, 2002, 3:14:49 AM, you wrote: EA> The transparency is hard to understand without doc. The first difference Do you have Holger's post about this? I think it explained almost all that is needed, but maybe I'm wrong. http://www.escribe.com/internet/rebol/m15951.html Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

 [20/21] from: rebol665:ifrance at: 12-May-2002 12:09


Hi Etienne EA> I thought this View version was a beta release ... Yes it is but it seems logical that the changes are there forever and not to be removed. Therefore programs have to be adapted. As I said previously, I am using a "simplified" version of your aqua-blue skin. Mainly just buttons, backdrop, and text. EA>An other thing : if your script runs well on the new version, it will EA>run well on the previous one (I test this everyday). My situation is different, since I am using 2.5.2, almost all my programs are ugly : - buttons have squared corners. It seems to be a transparency problem.I have tried little things with the key effect with no results. - backdrop-norm are wrongly displayed on the left border. It seems that they are displayed twice. On time rightly then again with a small shift to the right. EA>What can I share ... ? If you solve the problems described above, your code will be appreciated. You could make it available for the list or email it to me privately. Patrick ----- Original Message ----- From: "Etienne ALAURENT" <[etienne--alaurent--free--fr]> To: <[rebol-list--rebol--com]> Sent: Sunday, May 12, 2002 3:14 AM Subject: [REBOL] Re: Graph Drawing & /View Performance Hi, Pat, I thought this View version was a beta release ... What can I share ... ? I can say I discovered two new widgets : drop-down and scroller (witch derives from slider + 2 arrow buttons). The slider's code and feel are not the same as in the previous version. If you used a derived widget, it could not run now. The transparency is hard to understand without doc. The first difference I saw between the 2 versions is that to make a face transparent you must set its 'color to none. I noticed in View 1.2.1 it was not obligatory. An other thing : if your script runs well on the new version, it will run well on the previous one (I test this everyday). I didn't notice other thing particular. pat665 wrote:
>Hi Etienne, >I see your point however the View 2.5.2 is released now. May be you could
<<quoted lines omitted: 16>>
>> >>I have been using a simplified version of your aquae-blue skin for a
while.
>>Are-you aware that it doesn't work properly with the 2.5.2 bÍta? Backdrops >>are not correctly displayed, buttons are squared ?
<<quoted lines omitted: 11>>
>subject, without the quotes. >___________________________________________________________________________
___
>ifrance.com, l'email gratuit le plus complet de l'Internet ! >vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... >http://www.ifrance.com/_reloc/email.emailif >
-- regards. --- Etienne

 [21/21] from: etienne:alaurent:free at: 17-May-2002 13:03


Hi, Gabriele yes, I have Holger's post about transparency. It's interesting. I tested some stuff, and it runs. But I would like some examples to understand in depth how to make a "clean" script. See you on elite. Gabriele Santilli wrote:
>Hi Etienne, >On Sunday, May 12, 2002, 3:14:49 AM, you wrote:
<<quoted lines omitted: 4>>
>Regards, > Gabriele.
-- regards. --- Etienne

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted