R2-Beta - OLD - 2.7.6 Mezzanines (Coordinate development of mezzanine code)

Return to Index Page
Most recent messages (500 max) are listed first.

#UserMessageDate
147BTiffinYep; Nice. Figured it out seconds after posting and trying a few other datatypes, Go Bri Go! I wish I had finished a work assignment a week earlier; I missed out on a lot of efforts the august group here has put in recently. Well done.15-Mar-08 15:32
146BrianHA width of 0 is really an error, but not a serious enough one to complain about. That line screens for that, and just returns something that won't crash, cause a infinite loop, or even return a value of an unpredictable type.15-Mar-08 13:53
145BTiffinOr maybe not. Never mind.15-Mar-08 6:57
144BTiffinI know it's probably not too much of a biggy and too late: source extract function starts with if zero? width [return make block 0] block is input arg of series! extract 'a/b/c 0 returns some kind of weird empty path. I think it should be make block! 0 right?15-Mar-08 6:47
143BrianHI'm not sure PARSE would provide much of a speedup, what with the context switches required for the code blocks. I'll try it.9-Mar-08 3:48
142PaulI was thinking if you used the parse method with change/part you would have to probably build the rule block dynamically.9-Mar-08 3:42
141BrianHCarl's suggestion in the blog of a temporary series could be interesting, as I said in my comment to the blog article. I'll try it, profile and see, I guess.9-Mar-08 3:39
140BrianHFIND is pretty fast, though the CHANGE is the big slowdown particularly when the length of the before and after values are different. You would still need to use CHANGE in a PARSE version, and then you wouldn't have as easy a time of adding an /any option.9-Mar-08 3:37
139PaulBrian, couldn't 'replace be changed to utilize parse much in a similiar manner as your flatten function? To me that would be much more efficient. I'm not sure how that would handle replacement of series values though.9-Mar-08 3:33
138BrianHIf REPLACE was changed to a native (with /any and /only options added), I would celebrate. And this is after all of the work I have done making it efficient too. Please keep the function-value feature though, because that is the most useful feature it has.9-Mar-08 2:39
137BrianHAnother problem with REPLACE is that there is an increasing number of options that are requested of it, just to bring it to parity with the natives it is comparable to, such as FIND, INSERT, APPEND and CHANGE. We have gotten to the point in its complexity where we would need to use APPLY just to add the features on the R3 version - with the R2 version we are out of luck.9-Mar-08 2:37
136Carlhttp://www.rebol.com/article/0352.html8-Mar-08 19:27
135OldesI'm not going to rewrite my script anyway as I need rebcode to get the main speedup :(8-Mar-08 19:20
134Oldes(if you compare with insert tail!)8-Mar-08 19:19
133Oldesin R3 is the native append 1.6x faster, but if you think that improving replace is more required...8-Mar-08 19:18
132CarlFor R2, we need very close compatibility. For R3, less so. R3 is a chance to clean out the useless underbrush.8-Mar-08 19:13
131CarlAs Jerry recently pointed out, he used REPLACE for some Unicode strings, and gave up and aborted the code after 20 MINUTES of computation! That was just in REPLACE/all!8-Mar-08 19:13
130PaulCarl, what about backwards compatibliity? What should be the limit?8-Mar-08 19:13
129CarlI'd rather see us fix REPLACE.8-Mar-08 19:12
128CarlOldes: no, but I wonder how much speed gain we'd really see.8-Mar-08 19:12
127CarlBut, a native does not have that restriction, so it can completely deconstruct a series, operate on it, then rebuild it... an not worry about state. (Well, as long as GC is being carefully controlled during the op.)8-Mar-08 19:11
126Oldesis it difficult to add APPEND as native to R2?8-Mar-08 19:11
125CarlREPLACE as a mezz has the disadvantage that each action it takes on a series must be atomic (it cannot leave the series in some partial state, it must be valid).8-Mar-08 19:10
124CarlAnother area to address are mezz functions that cannot do their job very well. REPLACE is a perfect example...8-Mar-08 19:09
123CarlAnd, in fact, I should point out that is the wrong measure for such an action. Instead, we should profile the performance, and make decisions based on that.8-Mar-08 19:08
122PaulI think that is where I have my concerns is those high frequency mezzanines.8-Mar-08 19:08
121CarlAn exception to this rule is a very high frequency mezzanine. For example, in R3, a few functions like APPEND became natives. For most code, may make little difference, but it sure "feels" better.8-Mar-08 19:07
120CarlNow, there have also been cases where the code of a mezz function would be almost identical to that of a native, so there is no benefit to using a native.

For example, if the function is doing basic insert and append operations, then there's little value in the native, because it has the same overhead requirements... such as detecting string expansion conditions.

8-Mar-08 19:06
119CarlSo, a mezz is a light wrapper around other functions, normally natives. However, that's not a requirement. It is ok to use mezz functions in other mezz functions.8-Mar-08 19:03
118CarlIn general, mezz functions are "helpers" -- used to make coding easier, but without losing much in performance. For example, without FUNC, you would need to write make function! [....] each time.8-Mar-08 19:02
117CarlPaul asked: "Carl can you discuss briefly the goals you desire for mezzanines?"

My reply follows...

8-Mar-08 19:01
116PaulHow far back should we maintain backward compatibility with mezz functions?8-Mar-08 18:22
115PaulThanks Brian. I'll look into some changes for beyond 2.7.6.8-Mar-08 18:21
114BrianHCool stuff is not the only reason I was doing the backports.8-Mar-08 17:36
113CarlGood to know.8-Mar-08 17:35
112BrianHFor that matter, during the course of backporting code from R3 to R2, I found three bugs in R3, and submitted their fixes :)8-Mar-08 17:33
111BrianHDon't worry too much about R3 compatibility - we already have plenty of other people to do that.8-Mar-08 17:21
110BrianHIf you want to contribute, please do. Don't worry about micro-performance patterns unless you are willing to test first, but the algorithmic slowdowns and logic bugs will be fair game. Keep in mind though, that R2 development is a collaborative process and that R2 is a platform with legacy code that shouldn't be broken lightly.8-Mar-08 17:20
109BrianHPaul, we will need your help too. Your own code and experience serves as another reference for us to examine, and we need the eyes.8-Mar-08 17:16
108BrianHSorry Henrik, but we will definitely be improving problem mezzanines in R2, and already have. The mezzanine source constitutes a largeish body of REBOL source, and going over it will give us ideas for improvement that can and will propagate to R3 as well. We have already changed some functions to natives in R3 based on usage patterns. With more usage information, we will get more ideas.8-Mar-08 17:14
107BrianHPerhaps ALSO was not the best example. Profile first, rewrite later - that's what I do.8-Mar-08 17:09
106BrianHIf you looked at the source to ALSO, you would realize that it has only one get/any statement. Most of the work is being done by REBOL's evaluation rules, before the function is even called. And it is a native in R3.8-Mar-08 17:06
105PaulI guess I'll stay clear then of mezzanines as I don't know enough about R3 to contribute then.8-Mar-08 16:26
104HenrikI don't think we can do much more optimization on R2 mezzanines for multiple reasons:

1. It's time consuming and we have R3 to build. 2. We might introduce new bugs or crashes, trying to rebuild working mezzanines into natives. 3. R2 is well established. Its bug list is fairly well known. We have to be very careful with what is changed.

We can add capabilities to the mezzanines to bring them to R3 level or backport some R3 natives to R2 mezzanines to iron out some functionality differences, but they will not be as fast as the R3 versions. R3 will in some cases be much faster and efficient than R2, even with mezzanines.

8-Mar-08 16:08
103PaulYeah I know I can do that Henrik but want to know what we should do for R2 since that is what this group is about. I was going to work on some of the mezzanines and want to get an idea on what way we want to go. I chain the mezzanines if that is the way we want to go.8-Mar-08 16:00
102HenrikIf you don't want extra evaluation, you should not use the mezzanines. Study the source code for the mezzanines you use, and peel off the bits you don't need. For loops, don't use FORALL, but natives like WHILE, REPEAT or UNTIL. Use INSERT TAIL instead of APPEND, etc. Preallocate blocks and keep them around to avoid too much garbage collection. Spend time profiling the functions. But your code will be bigger and possibly uglier.8-Mar-08 15:50
101PaulI hope Carl can chime in on what he believes our goals should be for mezzanine development.8-Mar-08 15:45
100PaulI'm buidling a database as you know and I look at lot at performance especially when a function must run against millions of rows of data per query. I see a lot of extra evaluation that doesn't necessarily have to be incurred.8-Mar-08 15:43
99HenrikBeing small and simple has more to do with how humans manage source code, than how computers manage it. Modern PCs can throw around much bigger and heavier languages than REBOL, like Java quite fine, but REBOLers just don't like that needless complexity on the human side. Productivity, reliability and stability is a direct result of REBOL's philosophy. It must not be sacrificed for some speed increases, if it can be avoided.8-Mar-08 15:40
98HenrikREBOL will never be as fast as C or if all functions were native. IMHO, more natives makes REBOL harder to maintain and it will be more error prone, simply due to increased code size. Sacrificing code size for speed is directly the opposite of REBOL's philosophy of keeping its source code small and simple at all costs.8-Mar-08 15:35
97PaulSpeed has more barriers in computing in my opinion than capacity does.8-Mar-08 15:30
96PaulIndeed. ;-)8-Mar-08 15:27
95Henrikit's a tradeoff. if you want real speed, use rebcode :-)8-Mar-08 15:26
94PaulThat is what we should focus on since we are using an interpreted language.8-Mar-08 15:26
93PaulSpeed - yes.8-Mar-08 15:25
92Henrikspeed perhaps, but not efficiency (as in code size)8-Mar-08 15:25
91PaulWell were losing efficiency as a result in my opinion.8-Mar-08 15:24
90Henrikone of the reasons REBOL is so small is because of mezzanines building upon other mezzanines. theoretically you can build every function as native; it would be fast, sure, but only Carl would be able to change them and the REBOL executable would be in the 5-10 MB size range.8-Mar-08 15:24
89PaulI don't think it makes it easier to code new mezz functions but I think it isn't as efficient.8-Mar-08 15:23
88PaulI think there is a great amount of sweeping changes that we can make to mezzanines to eliminate mezzanine chaining and uitlize more natives.8-Mar-08 15:21
87Henrikwhy?8-Mar-08 15:21
86Henrikforall builds on forskip which builds on while8-Mar-08 15:21
85PaulYeah, I don't think that is right and they should be changed.8-Mar-08 15:20
84Henrikwhy not? there are already multiple functions in R2 that are mezzanines built upon other mezzanines.8-Mar-08 15:20
83PaulI don't like to see for example the 'also as part of 'take.8-Mar-08 15:19
82PaulConcerning mezzanines. 'I think we should avoid building mezzanines on mezzanine code8-Mar-08 15:17
81CarlUpdated r2-prot-http8-Mar-08 6:20
80BrianHCool.8-Mar-08 6:18
79CarlRegarding prot-http.r -- The one I have here is more recent. Updating devbase.8-Mar-08 6:16
78BrianHSubmitted r2-mezz-series #385: Backport of R3's MOVE mezzanine.8-Mar-08 1:15
77BrianHNote: TAKE and FIRST+ use ALSO.8-Mar-08 0:43
76BrianHSubmitted r2-mezz-series #383: Clone of R3's TAKE native as a mezzanine.8-Mar-08 0:20
75BrianHI'll submit it and you can make any changes in DevBase.8-Mar-08 0:16
74BrianHCarl, will this do?8-Mar-08 0:14
73BrianHI think it won't crash though.8-Mar-08 0:12
72BrianHI don't think that TAKE will work against a /direct port, but I can't be sure.8-Mar-08 0:12
71BrianHI checked its behavior against R3's take, but I don't know enough about images and gobs to make comparisons.8-Mar-08 0:11
70BrianHtake: func [ "Copies and removes from series. (Modifies)" [catch] value [series! port! none!] /part "Limits to a given length or position" length [number! series! port! pair!] /deep "Also copies series values within the block" /last "Take it from the tail end" ][ if value [throw-on-error [ case [ not length [length: 1] pair? length [ unless image? value [ throw make error! reduce ['script 'invalid-arg length] ] last: none ] any [series? length port? length] [ either same? head value head length [ length: subtract index? length index? value ][ throw make error! reduce ['script 'invalid-arg length] ] ] ] if last [ length: negate length value: tail value ] also copy/part value length remove/part value length ]] ]8-Mar-08 0:08
69BrianHOK, here's my first attempt at TAKE. My main questions are in image handling and error wording. Help!8-Mar-08 0:08
68PaulAh ok thanks Brian.7-Mar-08 23:20
67BrianHI think it's Ladislav's.7-Mar-08 23:19
66PaulI'm not familiar with timblk7-Mar-08 23:18
65BrianHI've been mostly profiling code patterns rather than whole programs - it's like manually doing peephole optimization.7-Mar-08 18:33
64BrianHThat sounds great! We should decide on a profiling tool. I've been using timblk, but that's mostly because I am not aware of any alternatives that have been tested on R3. If you know of anything better, please say so.7-Mar-08 18:32
63PaulAs well as via timed runs.7-Mar-08 18:04
62PaulI'm thinking we can at least just clean up many mezzanines. Like take the 'view function for example. We just need to clean up the code on many functions. For example, 'view could probably benefit from using case. In other words we should attempt to optimize alot of the performance of existing mezzanines. We can easily compares changes of the code to see if we get better performance via stats/evals.7-Mar-08 18:04
61BrianHSubmitted r2-mezz-series #380: - Backported new EXTRACT from R3. The new version is a little more complex, but is faster, safer, and lets you specify a default value instead of none. This function fixes a significant problem with the old EXTRACT, and was debated thoroughly on the R3 alpha list. The only change is to switch to R2-style error handling (thanks Gabriele!).7-Mar-08 16:23
60BrianHIn general, if you are going to make breaking changes or add new functions, do it in R3 first. Once the furor has died down there, then backport the functions to REBOL 2 as long as you can keep the spec and behavior the same. If you can't, then don't.7-Mar-08 16:18
59BrianHA good example is the change to ALTER, made originally for R3.

The new ALTER changes its return value to something useful: Whether the value has been added, true or false.

This change was prompted by someone noticing that the old return value of ALTER wasn't very useful. There was a long debate as to what would be useful, and the new function was the result. Great.

Before we could apply the change though, we had to find out whether the return result was used in any existing code. Using publically available code in REBOL.org as a statistical sample, I checked every reference to the word "alter" to see if any code referred to its return value - none did. With that information we were able to justify changing the return value.

7-Mar-08 16:15
58BrianHREBOL 3 is where the advanced research is happening. REBOL 2 has a lot of legacy code to not break, remember.7-Mar-08 15:42
57BrianHA good set of guidelines for R2 mezzanines are... - Backwards compatibility: Don't break anything in existing functions, just add capabilities if useful enough to justify the cost. - Forwards compatibility: Look to R3 first for function ideas, and even there try to avoid adding anything still being argued about. - Generally useful: Don't add anything unless many people would use it for many applications. - Minimize redundancy (we are not Perl): If there is a perfectly good way to do what you want to do in R2 already, try that first.7-Mar-08 15:41
56PaulI see all kinds of places to update mezzanines in 2.7.5 so I will attempt to submit them after this release since we pretty much determined to concentrate on bugs with this release and port back mezzanines from R3. So hopefully, we have this world for what lies beyond 2.7.6.7-Mar-08 13:54
55Gabrielethrow make error! if you want a function with [catch] to catch it.7-Mar-08 10:12
54Gabrielecause-error: make error! in R27-Mar-08 10:12
53BrianHSubmitted r2-mezz-control #379: - Added clone of R3's ALSO native as a mezzanine.7-Mar-08 8:26
52BrianHSubmitted r2-mezz-file #378: - Added IN-DIR and TO-RELATIVE-FILE from DevBase; they have already been incorporated in R3. The DevBase versions are R2 compatible and tested extensively.7-Mar-08 8:08
51BrianHREPLACE is getting complex enough that any more capabilities added to it in R3 may require using APPLY. The R2 version is just going to have to be complex I guess, or not improved :(7-Mar-08 7:53
50BrianHI think that we can port the improved EXTRACT as well, as soon as I figure out what the equivalent of cause-error is in R2.7-Mar-08 7:51
49BrianHSubmitted r2-mezz-series #377: - Backported all of the stability fixes from R3 (mostly changing some words to get-words). - Backported the improvements to ARRAY and REPLACE, which could run without changes.7-Mar-08 7:49
48Paulsee from those same flags I can do:

>> evals [flag1 flag2 flag3][1 "flag one" 2 "flag two" 3 "flag 1 & 2"] == "flag 1 & 2"

4-Mar-08 0:23
47PaulIt isn't meant to replace case but to do what is inconvient to do in case.4-Mar-08 0:22
46Paulyou can evaluate for any combination in evals.4-Mar-08 0:20
45BrianHThat handles the CASE [ALL] pattern, but not the CASE [ANY] pattern.4-Mar-08 0:18
44PaulYou have to think in terms of base-2 when your building your second argument. But I would rather use evals then mess with a bunch of any's and all's.4-Mar-08 0:12
43PaulMust easier to implement I would suppose depending on how many options your passing.4-Mar-08 0:11
42BrianHIs that faster than the CASE [ANY or ALL] method?4-Mar-08 0:06
41Paulsay you have the following:

flag1: true flag2: true flag3: false

then you could do something based on desired combinations of the flags:

>> evals [flag1 flag2 flag3][0 "default - all false" 3 "flag1 and flag2 are both true"] == "flag1 and flag2 are both true"

4-Mar-08 0:03
40Paulwhat about a function like this:

evals: func [blk blk2 /local i r ][ r: i: 0 foreach item blk [if get item [r: r + (2 ** i)] i: i + 1] return select blk2 to-integer r select blk2 0 ]

could be used for evaluation based on checkboxes and combinations of refinements

3-Mar-08 23:55
39BrianHSorry, get-words :)3-Mar-08 23:50
38BrianHThere's a few words in the source of the other mezzanines that should be converted to set-words for safety, such as in JOIN.3-Mar-08 23:49
37PaulCOOL!3-Mar-08 23:49
36BrianHARRAY, REPLACE and ALTER have been rewritten in R3 - ALTER for speed, ARRAY and REPLACE for support of function values.3-Mar-08 23:48
35PaulThat is a pretty good list right there.3-Mar-08 23:47
34BrianHWe should also consider TAKE, FIRST+, and ALSO - they're natives but would be easy to make mezzanines of, if slower.3-Mar-08 23:47
33PaulI guess replace is newer code than the 'replace in 2.7.5?3-Mar-08 23:46
32BrianHMOVE would require some minor changes, TO-RELATIVE-FILE would require changes that have been already figured out.3-Mar-08 23:45
31BrianHarray, replace, move, alter, in-dir, to-relative-file, ...3-Mar-08 23:44
30PaulWhat mezz functions in R3 are you considering?3-Mar-08 23:39
29PaulYeah go ahead and close it - I can't remember why word? was a problem.3-Mar-08 23:35
28Paultesting something3-Mar-08 23:34
27PaulWait a minute3-Mar-08 23:34
26BrianHI suppose so. Cool.3-Mar-08 23:33
25PaulDisregard it Brian and we should be able to close out two Rambo tickets also.3-Mar-08 23:32
24PaulYes3-Mar-08 23:30
23BrianHA literal, you mean? Rather than a reference?3-Mar-08 23:29
22Pauljust as a value apart from a set-word3-Mar-08 23:28
21Pauljust to distringuish between something that is a static value verses everything else3-Mar-08 23:28
20BrianHAre you screening for variables, or a functions? You don't even check for paths. What do you hope to accomplish?3-Mar-08 23:27
19PaulThe valuable?: :word? function does work but I thought that was tried and produced a problem somewhere.3-Mar-08 23:26
18Paulfor example 'print and "print" would be values where as print would be an evaluator.3-Mar-08 23:25
17BrianHEverything is able to be evaluated :)3-Mar-08 23:25
16PaulJust to check and see if something able to be evaluated.3-Mar-08 23:24
15BrianHWhat is the purpose of that function?3-Mar-08 23:23
14BrianHYou can't assign to a refinement, and a set-word or get-word is no more assignable than a lit-word.3-Mar-08 23:23
13BrianHI misread it. Please read my second comment.3-Mar-08 23:22
12Paul== [print 'print "print"] >> any-function? blk/1 == false >> any-function? blk/2 == false >> any-function? blk/3 == false3-Mar-08 23:21
11BrianHActually, that valuable? function proposal could be replaced with this: valuable?: :word?3-Mar-08 23:21
10Paulany-function? doesn't return the same response as valuable?3-Mar-08 23:21
9BrianHThe proposal to add /only to REPLACE was more promising, though it wasn't clear if the /only should apply to the search value or the replace value, or both. What do you think?3-Mar-08 23:18
8BrianHin the -> is the3-Mar-08 23:16
7BrianHHonestly, I didn't see the point to that function. The only part that matters in the any-function? part.3-Mar-08 23:16
6PaulHow about this one?: http://www.rebol.net/cgi-bin/rambo.r?id=4317&3-Mar-08 23:14
5BrianHSounds good, but we don't really have the time for 2.7.6 to implement a whole lot of new stuff. Start first with existing functions and those from R3. There is a good chance that many bugs in the R2 functions have already been fixed in R3.3-Mar-08 23:12
4PaulWhat about proposing new mezz functions here?3-Mar-08 22:17
3BrianHIf you have bugs that can be fixed by someone other than Carl, here's the place to fix them.3-Mar-08 21:43
2BrianHIf anyone has any favorite mezzanines from REBOL 3 that you want backported, here's the place to request them.3-Mar-08 21:42
1BrianHThe purpose of this group is to coordinate any delevopment or bug fixing of the mezzanine functions. This will allow those who want to work on this process to help each other instead of stepping on each other's toes.3-Mar-08 21:42

Return to Index Page