World: r3wp
[Rebol School] Rebol School
older newer | first last |
Anton 16-Feb-2009 [2157] | layout [ backcolor black origin 0 ekran: image ] |
Henrik 16-Feb-2009 [2158] | also you don't need SHOW on 'window, but only 'ekran. |
Vladimir 16-Feb-2009 [2159] | aha..... I put show on 'ekran and speed is the same.... If Henrik's observation about replacing Show with prin... and that speed is the same... there is no need to mess with layout :) Is there some way of time profiling code ? how to find out wich part is slowest? By the way this script I want to use to make lookup tables for maping tunnel 3d coordinates onto screen so when I make those tables I can see if math is causing the slowdown.... And question for Anton, what did you use in your "Tunnel" demo.? show, direct image manipulation? or just effects for image datatype ? |
Henrik 16-Feb-2009 [2160x2] | in R2 you can only do that by making differences between time stamps |
but you only have roughly 1-10 ms precision | |
Anton 16-Feb-2009 [2162x2] | Actually, in my stargate demo (now that I look at it again more closely), I layout a window face with a single IMAGE face in it. I did this for some technical reason I can't remember, but I tried very hard not to make extra faces unnecessarily. |
Anyway, I use a combination of techniques. I use DRAW and face/effect/DRAW dialect heavily, COPY image!, image datatype "bulk-set alpha", some face/EFFECT dialect, and finally SHOW face. | |
Vladimir 16-Feb-2009 [2164] | I just tried to separate math functions like square root and arctan with simpler constant values and speed seams to go up a bit, but not to much.... Ill try to make lookup tables for all visible coordinates and see what will happen.... |
Anton 16-Feb-2009 [2165] | profiling: time0: now/precise (your code...) print difference now/precise time0 |
Henrik 16-Feb-2009 [2166] | changing CHANGE/DUP to POKE gives a slight speed up, but then you need to scale in a different way. |
Vladimir 16-Feb-2009 [2167] | I tried that..... doesn't matter to much.... making lookup tables.... |
Steeve 16-Feb-2009 [2168x2] | i made optimizations in R3, removed change/dup , parents, temp vars, etc... I also replaced repeat or for structures by loops (to avoid bind/copy ) It changes nothing. It remains slow. The reason is that the script does (10000 * i) iterations in R3, by just doing iterations and a show (no computations) it takes 4 seconds. Then, by just adding the square-root calcul, it takes 8 seconds (2 times slower). |
i a case like that, using rebcode for math calculus in big loops will be really faster | |
Anton 16-Feb-2009 [2170] | Yes, I was just remembering my efforts to squeeze performance out of such per-pixel frame drawing and I think Rebol interpreter is not fast enough for such tasks. I would use the external DLL interface to pass your image to a C DLL function. |
[unknown: 5] 16-Feb-2009 [2171] | We need rebcode in R3. I understand the fact that it can cause problems with other parts of code but if we specifically use it where it works it can add a tremendous boost to performance. |
Steeve 16-Feb-2009 [2172] | agree |
Anton 16-Feb-2009 [2173x2] | Read BrianH's post above (1 hour 22 minutes ago) about why rebcode will not be in R3. |
But talk of a new "different" rebcode... | |
[unknown: 5] 16-Feb-2009 [2175x2] | Exactly, why not just create an updated rebcode then. |
Brian's answer was more like an excuse than a reason. | |
Steeve 16-Feb-2009 [2177] | :) |
Anton 16-Feb-2009 [2178] | Sleepy time for me. I think I might try make the C DLL tomorrow. |
Vladimir 16-Feb-2009 [2179] | Thanks Anton! |
Steeve 16-Feb-2009 [2180] | Ch is a good candidate, it allows to build c code dynamicly |
Vladimir 16-Feb-2009 [2181] | There.... lookup table done...... speed difference obvious :) pause after click on button is rendering first frame.... do http://www.visaprom.com/tunel.r |
Steeve 16-Feb-2009 [2182] | do you have a little gain with this ? repeat i 256 [ foreach pixel lookup [ set [pozicija red ugao] pixel red: red + i - 1 // 63 / 2 + 1 p: pick pick level red ugao if (p > 0) [ boja: pick paleta p change/dup skip ekran/image pozicija boja pixel_size ] ] show ekran ] |
Vladimir 16-Feb-2009 [2183x2] | its a nice refinment of code :) |
maybe its faster but my pc i to fast for me to notice.... Earlier today I tested script on three years old laptop.... Now I tried it on my home pc.. (amd 5000) and its to fast.... :) | |
kib2 16-Feb-2009 [2185] | Hi. I've got a local variable "level" inside an object, defined has follow : "level: length? t". If I try to print it, no problem. But if I use "build-markup {<%level%>}", REBOL raises a "ERROR no-value in: level". Any idea ? |
Geomol 16-Feb-2009 [2186x2] | Is your build-markup call outside the object? If yes, then you have to refer to level as object/level (where object is the name of your object). |
o: make object! [t: "abc" level: length? t] build-markup {<%o/level%>} | |
kib2 16-Feb-2009 [2188] | Geomol: no build-markup is called within my object. But I forget to say that I use "return build-markup {<%level%>}" I don't know if I can "return" local vars ? |
Geomol 16-Feb-2009 [2189] | return is normally used from within a function. So you have a function within your object, that returns what you say? |
kib2 16-Feb-2009 [2190] | 2 secs, I post the snippet |
Geomol 16-Feb-2009 [2191] | >> o: make object! [t: "abc" level: length? t f: func [] [return build-markup {<%level%>}]] >> o/f == "***ERROR no-value in: level" heh, funny! :-) |
kib2 16-Feb-2009 [2192] | http://clojurepastebin.appspot.com/2005 |
Geomol 16-Feb-2009 [2193x2] | Seems like a binding problem. |
This works: >> o: make object! [t: "abc" level: length? t f: func [] [return build-markup {<%o/level%>}]] >> o/f == "3" | |
kib2 16-Feb-2009 [2195x2] | In fact, my html-handler instance is within another object. |
Geomol: So, I have to refer to the object:/level as you told me before, that's it ? | |
Geomol 16-Feb-2009 [2197] | The difference is, you have level as a local to your function, I have level as a member of the object. What do you give to build-markup? It's a string, right? So build-markup don't know, what you mean by level, I think. |
kib2 16-Feb-2009 [2198] | Yes, I give it a string. But changing to "return build-markup {<%html-handler/level%>}" raises the same error. |
Geomol 16-Feb-2009 [2199x3] | Look at it from build-markup's viewpoint. How should it know, what level mean? This is a bit tricky part of REBOL, but it's also one of REBOL forces. |
level can mean anything depending on the context. | |
If you write you return like this, it will work: return build-markup rejoin ["<%" level "%>"] | |
kib2 16-Feb-2009 [2202] | Geomol: No, sorry I can't understand. level is defined one line before I use build-markup ( forget the print statement). |
Geomol 16-Feb-2009 [2203] | Now we force the value of level inside the string, before the string is giving to build-markup |
kib2 16-Feb-2009 [2204] | You're right, it works well. But I still don't understand the behaviour. |
Geomol 16-Feb-2009 [2205] | In my last example, the string become something like {<%3%>} In your example, the string is {<%level%>}. This is what build-markup see, and it has to figure out, what level mean. It can't figure that out, because level is a local of your function. |
kib2 16-Feb-2009 [2206] | Geomol: you mean that build-markup is sort of blind on locals ? |
older newer | first last |