World: r3wp
[!REBOL3 GUI]
older newer | first last |
Steeve 1-Mar-2010 [995] | like in R2 the time events generated by the rate propertie |
Cyphre 1-Mar-2010 [996] | AFAIK there is no RATE in R3. Or am I missing something? |
Steeve 1-Mar-2010 [997x2] | there's no rate but you can generate time events aswell |
not documented though | |
Cyphre 1-Mar-2010 [999] | you mean like make event! [] right? |
Steeve 1-Mar-2010 [1000x2] | yep |
but constructing an event is not enough, you have to know where to push it :) | |
Cyphre 1-Mar-2010 [1002] | ok, but even if you generate own events you need to WAIT at some point so the CPU is not at 100% no? |
Steeve 1-Mar-2010 [1003x3] | no, it depends of the duration of the process triggered by your events, if it takes too much time, it will froze the CPU obviously. |
i have not made tests so far actually | |
just guessing | |
Cyphre 1-Mar-2010 [1006] | can you post any example if it is not too big? |
Steeve 1-Mar-2010 [1007x2] | i could, perhaps tomorrow, i have not the source at my home. |
The principle is simple. At startup, I build an event time!, the I push it in the block located at system/view/event-port/state. And In my global event handler, each time I receive this event, I repush it immedialtly in the queue. I receive 1000 time! events per seconds in My tests, but it mights depend of the speed of your UC | |
Cyphre 1-Mar-2010 [1009x2] | ok, no hurry...I'll also try to play with it later. |
hmm, I pushed event into the event-port/state but nothing happened here. the event is still there and was not send to my global handler. | |
Steeve 1-Mar-2010 [1011] | did you do a do-events ? |
Cyphre 1-Mar-2010 [1012] | yes, tried both do-events or just calling VIEW |
Steeve 1-Mar-2010 [1013] | i will post it tomorow, it tried only on XP |
Cyphre 1-Mar-2010 [1014] | is that some new feature? I'm using 2.100.97.3.1 release under Win XP |
Steeve 1-Mar-2010 [1015x2] | i don't think so, actually it's a trick i discovered accidentaly. I don't thing Carl thought about it |
i used 97 too | |
Cyphre 1-Mar-2010 [1017] | do I need to set the event properties in some specific way? |
Steeve 1-Mar-2010 [1018] | i just made make event! [type: 'time port: port-event] (yes you need to add the port-event, if not it doen't work) |
Cyphre 1-Mar-2010 [1019] | doesn't work here even if I put the reference to event port inside the event |
Steeve 1-Mar-2010 [1020x2] | Hmm... i will post my complete test then. |
How did you created the port-event ? | |
Cyphre 1-Mar-2010 [1022] | I just put there reference to system/view/event-port |
Steeve 1-Mar-2010 [1023] | event-port: system/view/event-port: open event:// And then you added you handler at port-event/awake right ? |
Cyphre 1-Mar-2010 [1024] | I'm using the official init-view-system so the sequence looks like: init-view-system p: system/view/event-port insert system/view/event-port/state ev: make event! [type: 'time port: p] ... |
Steeve 1-Mar-2010 [1025x2] | by default there is nothing at system/view/event-port |
Hum ok, i don't use it because i don't like it, i do my own ;-) | |
Cyphre 1-Mar-2010 [1027] | yes, but try: source init-view-system this is a shortcut for creating the event-port |
Steeve 1-Mar-2010 [1028] | i takes one line to make it |
Cyphre 1-Mar-2010 [1029] | I want to be compatible with VIEW so I'm using the system handler. But anyway, this shouldn't make any difference no? |
Steeve 1-Mar-2010 [1030x2] | hum ok, it should not be a burden |
no, i see no difference | |
Cyphre 1-Mar-2010 [1032] | unles you are using some 'special' handler :) |
Steeve 1-Mar-2010 [1033x2] | We will see :-) But obviously there is something different cause it works here |
goto bed GN | |
Cyphre 1-Mar-2010 [1035] | me too...cu |
Gabriele 2-Mar-2010 [1036] | Steeve, how is your approach different from a busy loop? |
Cyphre 2-Mar-2010 [1037] | Gabriele, that was my question too. Currently If you have 'busy loop', no matter what technique you are using, you need to 'idle' at some point to give CPU some free time. Currently I don't know of a way how to do it in R3 as the CPU is getting high even on very long(in terms of CPU time) idle delays. |
Steeve 2-Mar-2010 [1038] | try this: screen: system/view/screen-gob event-port: system/view/event-port: open event:// event-queue: system/ports/system/state push-event: func [event][append event-queue event] push-event time-event: make event! [type: 'time port: event-port] process-timers: does [ push-event time-event forskip timers 2 [ case [ not integer? timers/1 [] positive? timers/1 [timers/1: timers/1 - 1] zero? timers/1 [timers/1: do :timers/2] ] ] ] event-port/awake: func [event][ switch/default event/type [ time [process-timers] close [halt] ][ print [event/type event/offset now/time/precise] ] ] timers: [ 1000 [print ["1000 ticks" now/time/precise] 1000] 4500 [print ["4500 ticks" now/time/precise] 4500] ] show append screen make gob! [ offset: 50x50 size: 100x100 flags: [resize] ] do-events |
Cyphre 2-Mar-2010 [1039] | Ah, so you are inserting the events system port not event port. That was the difference. I tried it here...works here in case the event loop doesn't contain any time consuming code(ie. is almost 'empty' as in your example). But when I add some 'load' into the loop then receiving of other event types is going to be rapidly limited/blocked when comparing to the FOREVER loop. Either I'm doing something wrong or inserting events from the awake handler somehow blocks the whole flow. |
Maxim 2-Mar-2010 [1040x2] | cyphre, your system is similar to the R2 globs engine in spirit. |
but since the data is stuff I create, I can't READ the data which is being managed by AGG. which would be the major benefit of "draw elements" | |
Pekr 3-Mar-2010 [1042x2] | So let's have DRAW elements then, no? :-) |
Cyphre - do you understand, what Max wants? And for us dumb - would it be a benefit, to have "draw elements"? :-) | |
Cyphre 3-Mar-2010 [1044] | Maxim, with this system you can easily manage any draw element or group of draw elements inside draw block. I have been thinking about this and I don't see any benefit being able to access the data at the level of internal AGG structure. Rather it looks like it would make the whole system more complex. The only thing which could be useful is being able to 'cache' already parsed DRAW block. That change can be done without much complications. But I should also mention that the 'parsing phase' is very little part of the performance overhead so cahing the internal structure would be theoretically useful only for really big DRAW blocks with tens of thousands and more elements..but such big blocks would be still not much usable becuase of the final performance of the rasterizing/rendering phase in such case. But I'm still open and I'd like to know your clarification and explanation of the benefits you see in your requested feature though. |
older newer | first last |