World: r3wp
[Core] Discuss core issues
older newer | first last |
Maxim 18-May-2010 [16797] | though for these tests, no swapping occured. |
Henrik 18-May-2010 [16798x2] | I recently watched a talk by Poul Henning Kamp, author of Varnish, who talked about how many people misunderstand how memory allocation works in modern OS'es. Since he's a FreeBSD kernel developer, he has some bias, but he made some interesting points in that memory allocation is nearly free in various unixes, but most people ignore that an only allocate, perhaps just enough or below what they need. |
Whether this can be translated directly to REBOL, I don't know. | |
Maxim 18-May-2010 [16800] | problem is when you task switch, or run several RAM intensive apps... they do kill each other, even on unix. |
Henrik 18-May-2010 [16801] | but that's because the RAM is actually used, correct? |
Maxim 18-May-2010 [16802x2] | (based on rendering 3D animations which required 4GB of swap file , just to load a scene ;-) |
yes... but as long as only one application is running the CPU, you can have A LOT of apps in virtual RAM without real system slow down (on unix). | |
Henrik 18-May-2010 [16804x2] | I guess I'm wrong with Windows. allocating a 100 MB string takes time. |
takes even longer under OSX. | |
Tomc 20-May-2010 [16806x3] | while[here: find/skip here key 2][insert tail result second here here: at here 2] |
rebol0 (untried) suspect parse is more efficent | |
ahh party moved to profileing and it has all been done | |
Pekr 20-May-2010 [16809x2] | For more precise system usage under Windows, please use SysInternals tools (now part of MS) |
http://technet.microsoft.com/en-us/sysinternals/default.aspx... look at RAM Map, Process Manager, etc. | |
Terry 20-May-2010 [16811x2] | Q. how to use a word as a string value in path? ie: ["a" 1 "b" 2] n: "b" ie/(n) >> 2 |
nvm | |
Claude 20-May-2010 [16813x2] | very strange a: true logic? a => true |
but a:[true] logic? a/1 => false | |
Sunanda 20-May-2010 [16815] | That's because [true] is a word, not a value. Try this: a: reduce [true] logic? a/1 >> true |
Claude 20-May-2010 [16816] | oki thanks |
Terry 24-May-2010 [16817x2] | What's the advantage of using words in blocks? ie: [a "one b "two] vs ie2: ["a" "one" "b" "two"] |
seeing you run out global word space very quickly? | |
Henrik 24-May-2010 [16819] | dialects and selection |
Terry 24-May-2010 [16820x2] | ie2/("a") >> "one" |
so dialects then? | |
Pekr 24-May-2010 [16822] | yes, and the code readability maybe - ie2/("a") vs ie2/a |
Henrik 24-May-2010 [16823] | using words as table keys is probably not a good idea. |
Pekr 24-May-2010 [16824] | why? because of word limit? or any other consequences? |
Henrik 24-May-2010 [16825] | limit, forbidden chars, etc. |
Ladislav 24-May-2010 [16826x3] | word comparison is faster than string comparison |
(word comparison is O(1), while string comparison is O(n)) | |
moreover, words have context, strings don't | |
Geomol 24-May-2010 [16829] | Is it a benefit, that SWITCH is case insensitive? >> s: "aA" == "aA" >> switch s/1 [#"A" [print "A"] #"a" [print "a"]] A |
Steeve 24-May-2010 [16830] | use strings not chars |
Gregg 24-May-2010 [16831x2] | On words in blocks, if you use strings they may be duplicated as you copy blocks, which words aren't. |
On SWITCH, I think it's consistent with REBOL in general. | |
Geomol 24-May-2010 [16833x3] | Steeve, no, doesn't work with strings: >> switch s/1 ["A" [print "A"] "a" [print "a"]] == none s/1 is a char! And SWITCH won't find it with a string. |
Gregg, "consistent"? Ahh... ;) I was thinking about changing the string into a binary. What would you think FIRST used on a binary returns? I would expect a binary, but it's actually an integer. I sometimes have a hard time seeing the consistency in REBOL. But I know, it's hard to find the logic way in all this. So many datatypes. :) | |
Also changing s/1 to a string gives unwanted result: >> s == "aA" >> switch to string! s/1 ["A" [print "A"] "a" [print "a"]] A So I end up with getting the integer value of a char to make this work: >> switch to integer! s/1 [65 [print "A"] 97 [print "a"]] a Not so good, as I see it. | |
Steeve 24-May-2010 [16836x2] | Ah! it's probably impossible to convert a char! into a string!, so forget it... |
hmmm. I just realized that you asked for insensitive case | |
Geomol 24-May-2010 [16838x2] | Yes, I need to test on chars in a string, and #"a" should be different from #"A". |
The only way using SWITCH, I see, is to operate with ascii values, and that isn't good. | |
Steeve 24-May-2010 [16840] | well, just use parse instead, its mostly the same structure than a switch. parse/case s [ #"A" (do something) | #"a" (...) | ... ] |
Geomol 24-May-2010 [16841] | Yes, parse can be used. My motivation was thoughts about switch. It seems, it could be improved. |
Andreas 24-May-2010 [16842x4] | REBOL3 is pretty consistently case-ignorant in this regard: |
>> #"a" = #"A" == true | |
And the SWITCH behaviour is just consistent with that. | |
(R2 is more inconsistent in this regard, as #"a" = #"A" is false, but SWITCH behaves case-insensitively, as you described.) | |
PeterWood 25-May-2010 [16846] | >> #"a" == #"A" == false Perhaps SWITCH needs a /Strictly refinement? |
older newer | first last |