Re: [Pharo-dev] Welcome norizzk.com
On 29 May 2014, at 22:42, stepharo steph...@free.fr wrote: I would love so much that the deployment is also using Pharo. :) May be with Mongo it will also be possible in the future. I can understand you want that and I think it is a healthy desire. But I would love the Pharo ecosystem to embrace Gemstone far more than it does today. Such power at your fingertips... Johan
[Pharo-dev] String deduplication
Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
[Pharo-dev] [pharo-project/pharo-core]
Branch: refs/tags/40008 Home: https://github.com/pharo-project/pharo-core
[Pharo-dev] [pharo-project/pharo-core] 482e24: 40008
Branch: refs/heads/4.0 Home: https://github.com/pharo-project/pharo-core Commit: 482e248cc700b2346d9c53f98bcad91dc0fbe805 https://github.com/pharo-project/pharo-core/commit/482e248cc700b2346d9c53f98bcad91dc0fbe805 Author: Jenkins Build Server bo...@pharo-project.org Date: 2014-05-30 (Fri, 30 May 2014) Changed paths: A Graphics-Primitives.package/Color.class/instance/recategorized/fillRectangle_on_.st A Morphic-Base.package/extension/BorderStyle/class/complexAltFramed.st A Morphic-Base.package/extension/BorderStyle/class/complexAltInset.st A Morphic-Base.package/extension/BorderStyle/class/complexAltRaised.st A Morphic-Base.package/extension/BorderStyle/class/complexFramed.st A Morphic-Base.package/extension/BorderStyle/class/complexInset.st A Morphic-Base.package/extension/BorderStyle/class/complexRaised.st A Morphic-Base.package/extension/BorderStyle/class/inset.st A Morphic-Base.package/extension/BorderStyle/class/raised.st A Morphic-Base.package/extension/BorderStyle/class/simple.st A Morphic-Base.package/extension/BorderStyle/class/width_color_.st A Morphic-Base.package/extension/BorderedMorph/class/exampleGradient.st A Morphic-Base.package/extension/BorderedMorph/instance/addCornerGrips.st A Morphic-Base.package/extension/BorderedMorph/instance/addPaneSplitters.st A Morphic-Base.package/extension/BorderedMorph/instance/addPaneVSplitterBetween_and_.st A Morphic-Base.package/extension/BorderedMorph/instance/changeBorderWidth_.st A Morphic-Base.package/extension/BorderedMorph/instance/removeCornerGrips.st A Morphic-Base.package/extension/BorderedMorph/instance/splitters.st A Morphic-Base.package/extension/Canvas/instance/asAlphaBlendingCanvas_.st A Morphic-Base.package/extension/Canvas/instance/copyClipRect_.st A Morphic-Base.package/extension/FormCanvas/instance/asBalloonCanvas.st A Morphic-Base.package/extension/FormCanvas/instance/drawString_from_to_autoBoundAt_font_color_.st A Morphic-Base.package/extension/FormCanvas/instance/roundCornersOf_in_during_.st A Morphic-Base.package/extension/FormCanvas/instance/roundShadowCornersOf_in_during_.st A Morphic-Base.package/extension/GrafPort/instance/displayScannerFor_foreground_background_ignoreColorChanges_.st A Morphic-Base.package/extension/HandMorph/instance/generateDropFilesEvent_.st A Morphic-Base.package/extension/HandMorph/instance/waitForClicksOrDrag_event_selectors_threshold_.st A Morphic-Base.package/extension/Morph/instance/addHalo_.st A Morphic-Base.package/extension/Morph/instance/addHandlesTo_box_.st A Morphic-Base.package/extension/Morph/instance/addWorldHandlesTo_box_.st A Morphic-Base.package/extension/Morph/instance/assureLayoutProperties.st A Morphic-Base.package/extension/Morph/instance/assureTableProperties.st A Morphic-Base.package/extension/Morph/instance/borderColor_.st A Morphic-Base.package/extension/Morph/instance/borderWidth_.st A Morphic-Base.package/extension/Morph/instance/changeCellInset_.st A Morphic-Base.package/extension/Morph/instance/changeColor.st A Morphic-Base.package/extension/Morph/instance/changeLayoutInset_.st A Morphic-Base.package/extension/Morph/instance/changeMaxCellSize_.st A Morphic-Base.package/extension/Morph/instance/changeMinCellSize_.st A Morphic-Base.package/extension/Morph/instance/changeProportionalLayout.st A Morphic-Base.package/extension/Morph/instance/changeTableLayout.st A Morphic-Base.package/extension/Morph/instance/collapse.st A Morphic-Base.package/extension/Morph/instance/containingWindow.st A Morphic-Base.package/extension/Morph/instance/defaultBalloonColor.st A Morphic-Base.package/extension/Morph/instance/defaultBalloonFont.st A Morphic-Base.package/extension/Morph/instance/defaultBitmapFillForm.st A Morphic-Base.package/extension/Morph/instance/embedInWindow.st A Morphic-Base.package/extension/Morph/instance/embeddedInMorphicWindowLabeled_.st A Morphic-Base.package/extension/Morph/instance/exportAsGIF.st A Morphic-Base.package/extension/Morph/instance/exportAsPNG.st A Morphic-Base.package/extension/Morph/instance/fillWithRamp_oriented_.st A Morphic-Base.package/extension/Morph/instance/justDroppedInto_event_.st A Morphic-Base.package/extension/Morph/instance/newTransformationMorph.st A Morphic-Base.package/extension/Morph/instance/on_send_to_.st A Morphic-Base.package/extension/Morph/instance/on_send_to_withValue_.st A Morphic-Base.package/extension/Morph/instance/resizeMorph_.st A Morphic-Base.package/extension/Morph/instance/rowMorphForNode_inColumn_.st A Morphic-Base.package/extension/Morph/instance/setArrowheads.st A Morphic-Base.package/extension/Morph/instance/setShadowOffset_.st A Morphic-Base.package/extension/Morph/instance/useBitmapFill.st A
Re: [Pharo-dev] String deduplication
On 30 May 2014, at 09:39, Philippe Marschall philippe.marsch...@netcetera.ch wrote: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. One idea could be to have an explicit immutable string literal class (or to set the immutability for literals in the compiler when we have support for it for literals). These then would be save to de-duplicate, would be interesting to now how large the percentage is of literals among all your de-douplicated strings. When playing with first class references (that can in addition override behavior) we had the idea that one could use that for realising a general “copy on write” for any kind of object and even whole object graphs… the idea would be to search for object graphs that are the same and replace the all pointers with just pointer-objects that trap all writes to one singe copy. In a second step one could combine that with “crystallising” unused subgraphs (that is, serialise and compress them in memory, with references to the graph on-demand and transparently decompress). Combined, this would save a lot of space. But the devil is in the detail: how to find unused and equal subgraphs efficiently. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. Nice! Marcus
Re: [Pharo-dev] [squeak-dev] Re: String #=
On 28.05.14 22:24, Andres Valloud wrote: Hey Philippe, Yes but #= is blissfully unaware of normalization in Squeak/Pharo. In fact AFAIK Squeak/Pharo is unaware of normalization. Having a short look at it doesn't even look as if case insensitivity worked in Squeak/Pharo outside of Latin-1 (I could be wrong though). Yes, that's what I am thinking about. To be more explicit, suppose Unicode series of characters got into the image via the keyboard, a file, a socket... once decoded, what could one do with them? Are all types of decoded character series going to be represented as instances of a single class, although they have inherently different behavior? I don't understand the question. In addition you probably don't want #= to do normalization because performance. And even if you did you probably still want a fast path for ByteString receiver and ByteString argument in which case #size is safe. Assuming all fixed width representation strings (e.g. byte strings) will always have the same encoding (e.g. same code page), then the size check for those seems ok to me. All Strings are fixed width in Pharo/Squeak. If you have a single non-Latin1 character (code point) in a String all characters in the String are promoted from a byte to an OOP. #size then answers the number of OOPs instead of the number of bytes. So #size always answers the number of characters (code points) non-normalized (because there is no way to do normalization in Pharo/Squeak). Just to make sure, I am not celebrating all this complexity in the world... however, given that it's there, how are we going to deal with it? I'm concerned about the long term consequences of making things more complex than they are by reinterpreting them. The problem I see is that ultimately programs just won't Work(TM). This seems to me a more general discussion than the problem at hand. Again at the moment Pharo/Squeak is largely unaware of Unicode. It supports very large code points but without any semantics (similar to let's say Erlang with doesn't even have a String type). What Pharo/Squeak however does know about is encodings for mapping the Strings to and from bytes. And quite honestly doing normalization in #= may cause things to just won't Work(TM). Consider for example an HTTP request with a query string with two different query fields that are normalized equal. Would you want the values to be stored under one dictionary key? Cheers Philippe
Re: [Pharo-dev] String deduplication
Hello, I like the idea but this is not as simple. In some framework you may use different string with a same name as markers that are not equals. Typically: Object#string1 ^ 'string' Object#string2 ^ 'string' Object#test self assert: self string1 == self string1. Answers true self assert: self string2 == self string2. Answers true self assert: self string1 == self string2 Answers false Frameworks relying on that will not work any more. And this kind of bugs is not easy to spot, it typically crashes identity collections in a non deterministic fashion. Regards 2014-05-30 9:39 GMT+02:00 Philippe Marschall philippe.marsch...@netcetera.ch: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
Re: [Pharo-dev] String deduplication
Hmm, code that depends on 2 #= Strings to be not #== ? That would either be a very special case but more likely a bug. In any case, it won't be very common I guess. The mutability/immutability is a way more important issue, unfixable unless we introduce a new class IMHO. But saving 2MB is impressive. On 30 May 2014, at 10:59, Clément Bera bera.clem...@gmail.com wrote: Hello, I like the idea but this is not as simple. In some framework you may use different string with a same name as markers that are not equals. Typically: Object#string1 ^ 'string' Object#string2 ^ 'string' Object#test self assert: self string1 == self string1. Answers true self assert: self string2 == self string2. Answers true self assert: self string1 == self string2 Answers false Frameworks relying on that will not work any more. And this kind of bugs is not easy to spot, it typically crashes identity collections in a non deterministic fashion. Regards 2014-05-30 9:39 GMT+02:00 Philippe Marschall philippe.marsch...@netcetera.ch: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
[Pharo-dev] Build failed in Jenkins: Pharo-2.0 #366
See https://ci.inria.fr/pharo/job/Pharo-2.0/366/ -- [...truncated 18 lines...] Downloading PharoV10.sources: http://files.pharo.org/sources//PharoV10.sources.zip Downloading PharoV20.sources: http://files.pharo.org/sources//PharoV20.sources.zip Downloading PharoV30.sources: http://files.pharo.org/sources//PharoV30.sources.zip Creating starter scripts pharo and pharo-ui + ./pharo Pharo.image update [31m[33m === Notice: 0 new update file(s) processed. === [0m[0m+ zip Pharo.zip Pharo.image Pharo.changes adding: Pharo.image (deflated 58%) adding: Pharo.changes (deflated 89%) + ./pharo Pharo.image printVersion [version] 2.0 #20628 ++ ./pharo Pharo.image printVersion ++ grep --only-matching '[0-9]\{5\}' + VERSION=20628 + ./pharo Pharo.image save Pharo-20628 + zip 20628.zip Pharo-20628.image Pharo-20628.changes adding: Pharo-20628.image (deflated 58%) adding: Pharo-20628.changes (deflated 89%) + cp 20628.zip latest.zip + cp 20628.zip Pharo-Image-2.0-latest.zip + mkdir One + cp Pharo.image Pharo.changes pharo-vm/PharoV20.sources One + bash build-oneclick.sh -i One/Pharo -o Pharo2.0-portable -v 2.0 -t Pharo chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... --2014-05-30 11:43:06-- http://files.pharo.org/vm/pharo/linux/Pharo-VM-linux-stable.zip Resolving files.pharo.org... 128.93.162.72 Connecting to files.pharo.org|128.93.162.72|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1715972 (1.6M) [application/zip] Saving to: ‘Pharo-VM-linux-stable.zip’ 0K .. .. .. .. .. 2% 4.06M 0s 50K .. .. .. .. .. 5% 7.61M 0s 100K .. .. .. .. .. 8% 8.53M 0s 150K .. .. .. .. .. 11% 8.01M 0s 200K .. .. .. .. .. 14% 116M 0s 250K .. .. .. .. .. 17% 8.10M 0s 300K .. .. .. .. .. 20% 110M 0s 350K .. .. .. .. .. 23% 9.17M 0s 400K .. .. .. .. .. 26% 83.5M 0s 450K .. .. .. .. .. 29% 9.37M 0s 500K .. .. .. .. .. 32% 99.6M 0s 550K .. .. .. .. .. 35% 67.6M 0s 600K .. .. .. .. .. 38% 9.11M 0s 650K .. .. .. .. .. 41% 112M 0s 700K .. .. .. .. .. 44% 9.22M 0s 750K .. .. .. .. .. 47% 111M 0s 800K .. .. .. .. .. 50% 73.6M 0s 850K .. .. .. .. .. 53% 9.25M 0s 900K .. .. .. .. .. 56% 165M 0s 950K .. .. .. .. .. 59% 9.03M 0s 1000K .. .. .. .. .. 62% 98.0M 0s 1050K .. .. .. .. .. 65% 84.3M 0s 1100K .. .. .. .. .. 68% 6.80M 0s 1150K .. .. .. .. .. 71% 62.8M 0s 1200K .. .. .. .. .. 74% 163M 0s 1250K .. .. .. .. .. 77% 7.13M 0s 1300K .. .. .. .. .. 80% 169M 0s 1350K .. .. .. .. .. 83% 36.3M 0s 1400K .. .. .. .. .. 86% 16.7M 0s 1450K .. .. .. .. .. 89% 30.9M 0s 1500K .. .. .. .. .. 92% 26.0M 0s 1550K
Re: [Pharo-dev] String deduplication
On 30 May 2014, at 10:59, Clément Bera bera.clem...@gmail.com wrote: Hello, I like the idea but this is not as simple. In some framework you may use different string with a same name as markers that are not equals. Typically: Object#string1 ^ 'string' Object#string2 ^ 'string' Object#test self assert: self string1 == self string1. Answers true self assert: self string2 == self string2. Answers true self assert: self string1 == self string2 Answers false Frameworks relying on that will not work any more. And this kind of bugs is not easy to spot, it typically crashes identity collections in a non deterministic fashion. With an indirection (a kind of reference) that - points to the string - forwards everything, but does a copy on write on state change - implements == to return false it would work. Of course you have then the same amount of objects(+1), but they would be all very small, thus leading to saving for large objects and especially when applied to subgraphs. Marcus Regards 2014-05-30 9:39 GMT+02:00 Philippe Marschall philippe.marsch...@netcetera.ch: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
[Pharo-dev] Change list background color in Pharo with Spec
http://stackoverflow.com/questions/23944704/change-list-background-color-in-pharo-with-spec
Re: [Pharo-dev] String deduplication
I'm curious to see which method is really using mutable strings. Of course, while constructing and write streaming on it, but then it's like a temporary storage area and we don't have to care. We're speaking of a place where a String would be modified to retain some state... Of course, since we can't exclude this possibility theoretically, the proposed changed is unsafe. But practically... 2014-05-30 13:46 GMT+02:00 Marcus Denker marcus.den...@inria.fr: On 30 May 2014, at 10:59, Clément Bera bera.clem...@gmail.com wrote: Hello, I like the idea but this is not as simple. In some framework you may use different string with a same name as markers that are not equals. Typically: Object#string1 ^ 'string' Object#string2 ^ 'string' Object#test self assert: self string1 == self string1. Answers true self assert: self string2 == self string2. Answers true self assert: self string1 == self string2 Answers false Frameworks relying on that will not work any more. And this kind of bugs is not easy to spot, it typically crashes identity collections in a non deterministic fashion. With an indirection (a kind of reference) that - points to the string - forwards everything, but does a copy on write on state change - implements == to return false it would work. Of course you have then the same amount of objects(+1), but they would be all very small, thus leading to saving for large objects and especially when applied to subgraphs. Marcus Regards 2014-05-30 9:39 GMT+02:00 Philippe Marschall philippe.marsch...@netcetera.ch: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
Re: [Pharo-dev] Change list background color in Pharo with Spec
2014-05-30 14:24 GMT+02:00 Esteban Lorenzano esteba...@gmail.com: http://stackoverflow.com/questions/23944704/change-list-background-color-in-pharo-with-spec How about this: ListModel new items: (1 to: 10); backgroundColorBlock: [ :item :index |Color red ]; openWithSpec. (I am not registered at stackoverlfow, please forward).
[Pharo-dev] Recover lost changes doesn't recover classes created.
Recover lost changes doesn't recover classes created. Mac Mavericks Open 30848 image Create a package AA Create a class AAA in it Create a method in it, setting the author Create a subclass of AA BB Quit without saving. Restart image, try to recover
Re: [Pharo-dev] Recover lost changes doesn't recover classes created.
https://pharo.fogbugz.com/default.asp?13290#103226
Re: [Pharo-dev] GPU accelerated GUI
darrinm wrote On my Mac, Pharo's UI performance (e.g. window dragging, scrolling, any kind of animation) is quite a bit less than the rest of the system. I expect high frame rates for such basic things. It impacts everything I do and makes me sad. I'm still learning and would like to know: 1) Is this also the case on Linux and Windows? 2) I'm reading that Pharo's GUI is not hardware accelerated. Is this the primary issue with UI performance? 3) If so, is work to incorporate hardware acceleration in progress? 4) If so, how can I help?! - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/GPU-accelerated-GUI-tp4760898p4761007.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] OpenGL 3.0+
darrinm wrote I'm trying to use #version 330 OpenGL shaders but NBOpenGL, on OSX anyway, doesn't: 1. Specify the appropriate attributes (KCGLOGLPVersion_3_2_Core) when requesting a gl context. 2. Deal with other differences between OpenGL 3.0 and prior versions (e.g. changes to querying extensions and built-in extensions). I can fix this but I'd like my to fix to be in line with Pharo plans for OpenGL support. What are they? Continue to support older OpenGL versions? Deprecate them somehow? - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/OpenGL-3-0-tp4760914p4761008.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] OpenGL 3.0+
darrinm wrote Oh, and NBMacGLConstants is lacking necessary constants. Is it manually created or generated somehow? - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/OpenGL-3-0-tp4760914p4761009.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] String deduplication
I hope you're only considering this one-time for your Pharo release image, and not something that will _continue_ to operating on an on-going basis. Attempting to do that below app-layer would be way too intrusive for, for example, a Magma application..A String read from one DB session belongs to that session. If it were canonicalized and suddenly belonged to two sessions, then mutating it would end up committing that change in both sessions. Bad. Strings aren't the only type to share. What about Dates? And literal-Array's? Timezones and Durations? This is an app-responsibility, not a system one. A one-time compress prior to release is okay, but not automatically behind the scenes.. On Fri, May 30, 2014 at 2:39 AM, Philippe Marschall philippe.marsch...@netcetera.ch wrote: Hi This is an idea I stole from somebody else. The assumption is that you have a lot of Strings in the image that are equal. We could therefore remove the duplicates and make all the objects refer to the same instance. However it's not a simple as that. The main issue is that String has two responsibilities. The first is as an immutable value object. The second is as a mutable character buffer for building immutable value objects. We must not deduplicate the second kind. Unfortunately it's not straight forward to figure out which kind a string is. The approach I took is looking at whether it contains any 0 characters. An other option would be to check whether any WirteStreams are referring to it. Also, since there are behavioral differences between String and Symbol besides #= we must exclude Symbols (eg. there is #'hello' and 'hello' in the heap and they compare #= true but we must not make anybody who refers to 'hello' suddenly refer to #'hello'). Anyway here's the code, this saves about 2 MB in a fairly stock Pharo 3 image. Sorry for the bad variable names. | b d m | b := Bag new. d := OrderedCollection new. m := Dictionary new. count all string instances String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ b add: s ] ]. find the ones that have no duplicates or are likely buffers b doWithOccurrences: [ :s :i | (i = 1 or: [ s anySatisfy: [ :c | c codePoint = 0 ] ]) ifTrue: [ d add: s - i ] ]. remove the ones that have no duplicates or are likely buffers d do: [ :a | a value timesRepeat: [ b remove: a key ] ]. map all duplicate strings to their duplicates String allSubInstancesDo: [ :s | s isSymbol ifFalse: [ (b includes: s) ifTrue: [ | l | l := m at: s ifAbsentPut: [ OrderedCollection new ]. l add: s ] ]. remove the duplicates m keysAndValues do [ :k :v | | f | f := v at: 1. 2 to: v size do: [ :i | (v at: i) becomeForward: f ] ] Cheers Philippe
Re: [Pharo-dev] Change list background color in Pharo with Spec
Nicolai Hess wrote (I am not registered at stackoverlfow, please forward). Done. - Cheers, Sean -- View this message in context: http://forum.world.st/Change-list-background-color-in-Pharo-with-Spec-tp4760977p4761012.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] TilingWindowManager -- WorldManager? [Pharo3.0]
That's: TWMWorldManager instance createOrSwitchToWorldNamed: 'JustAnotherWorld'. TWMWorldManager instance createOrSwitchToWorldNamed: 'Pharo'. Cheers, Laurent Le vendredi 30 mai 2014, 06:27:39 H. Hirzel a écrit : Hello I installed TilingWindowManager through the MetacelloConfigurationBrowser in Pharo 3.0. The class comment of TWMWorldManager says I provide an unlimited number of blank canvases on which to create... Add a world: WorldManager instance createOrSwitchToWorldNamed: 'JustAnotherWorld'. Return to the default world: WorldManager instance createOrSwitchToWorldNamed: 'Pharo'. However the global WorldManager is not known anymore. What do I need to use instead? Thank you for the answer in advance Hannes
[Pharo-dev] Gravatar improvement Smalltalkhub
Hi Mathias, thanks for the contribution. As you intended it for me updating Gravatar on STHub I consider it in agreement with MIT license and just uploaded. I also changed the repo to public write access now. Change is reflected in ConfigurationOfGravatar-TorstenBergmann.3 also, copied it to the MetaRepoForPharo30 as well - so one just can load simply from the config browser in Pharo 3.0 again. Thx T. Gesendet: Freitag, 30. Mai 2014 um 14:30 Uhr Von: Biard Mathias An: ... Betreff: Gravatar improvement Smalltalkhub Hi, I just add possibility to choose default image in case of 404 on your Gravatar. Here are the files if you want to update Smalltalkhub. Regards. Mathias
Re: [Pharo-dev] OpenGL 3.0+
Hello, I am also interested on this topic. For what I saw from NBOpenGL, Igor was generating the bindings from older specifications of the OpenGL API. Those older specifications are in a deprecated DSL. The newer versions of the OpenGL APIs are available in some XML files provided by Khronos Group. In this link http://www.opengl.org/registry/#specfiles another link for a subversion repository( https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/ ) with those XML files is available, along with the formal OpenGL specs. Because they are now in those XML files, we need new generator for OpenGL 3.3-4.0. Another question, a core profile context is really needed? Why not starting working with a compatibility profile?. OpenGL API deprecation does not depend on us, it depends on what the Khronos Group and the graphics card maker decide to do. In the x86 Desktop, the three big companies cannot remove the compatibility profile, otherwise lot of older video-games will stop working. Also, there are lots of graphic cards, specially older integrated in laptops that are only OpenGL 2.x. A better bet is to support at least the subset available in OpenGL 2.x that is also available in the core profile. As for plans for OpenGL support, normal and accelerated GUIs, I am working in OSWindow. OSWindow provides support to manage native operating system windows purely from image side. With Igor, we made a custom image and VM for Linux in which we removed almost everything graphic related from the VM. The only support needed in the VM is a small check for event presence in the VM heartbeat. For OSWindow, we made initially a XLib based back-end. To reduce maintenance efforts for Windows and Mac OS, I made a new backend based in SDL2. It is quite complete and I have tested mostly in Linux. For Windows I could make it work, not perfect so it needs more testing and a complete removal of the old Win32 drivers. I don't have a Mac for testing, but Alex is going to help me there. I have to tell the CMakeVMMaker to also build SDL2 before building, instead of having to build/install it manually. After that I think that we can start integrating into Pharo 4. As for OpenGL, SDL2 gives me a multi-platform abstraction for creating a window with an OpenGL context. I already made it work with NBOpenGL, the only tricky part is dependency order when loading the stuff in the image. In fact, I already started making a new 3D graphics engine Pharo, to rewrite Roassal 3D on top of this one in the near future. Soon I will be posting some screen-shots of this engine. With this graphics engine, I am also going to try to make an Athens backend, for accelerated vector graphics. Vectorial graphics with OpenGL are very hard to do fast, specially self intersecting bezier curves. Stencil based testing is simple, fast, supported and efficient for this job. Greetings, Ronie 2014-05-30 11:10 GMT-04:00 Sean P. DeNigris s...@clipperadams.com: darrinm wrote Oh, and NBMacGLConstants is lacking necessary constants. Is it manually created or generated somehow? - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/OpenGL-3-0-tp4760914p4761009.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] Change list background color in Pharo with Spec
Thank you! 2014-05-30 17:15 GMT+02:00 Sean P. DeNigris s...@clipperadams.com: Nicolai Hess wrote (I am not registered at stackoverlfow, please forward). Done. - Cheers, Sean -- View this message in context: http://forum.world.st/Change-list-background-color-in-Pharo-with-Spec-tp4760977p4761012.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] OpenGL 3.0+
Thanks for all the great info Ronie! On Fri, May 30, 2014 at 4:06 PM, Ronie Salgado ronies...@gmail.com wrote: Hello, I am also interested on this topic. For what I saw from NBOpenGL, Igor was generating the bindings from older specifications of the OpenGL API. Those older specifications are in a deprecated DSL. The newer versions of the OpenGL APIs are available in some XML files provided by Khronos Group. In this link http://www.opengl.org/registry/#specfiles another link for a subversion repository( https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/ ) with those XML files is available, along with the formal OpenGL specs. Because they are now in those XML files, we need new generator for OpenGL 3.3-4.0. OK. Where is the old generator? I will look into it if nobody is already doing so. Another question, a core profile context is really needed? Why not starting working with a compatibility profile?. OpenGL API deprecation does not depend on us, it depends on what the Khronos Group and the graphics card maker decide to do. In the x86 Desktop, the three big companies cannot remove the compatibility profile, otherwise lot of older video-games will stop working. Also, there are lots of graphic cards, specially older integrated in laptops that are only OpenGL 2.x. A better bet is to support at least the subset available in OpenGL 2.x that is also available in the core profile. Good points. Nevertheless, as I understand it, OSX does not provide a compatibility profile. You get core 2.1, 3.2, or 4.1 with OSX 10.7 or greater (released 3 years ago). Currently Pharo always gets OpenGL 2.1 core. So we are working with an API that was deprecated 6 years ago that can only take advantage of a fraction of the power of our GPUs and is discouraged/unavailable on mobile platforms. Maybe that is enough for some things but I'd like to see the door opened for more. This makes me wonder what the compatibility philosophy of Pharo is. Is it a goal that once something is developed in Pharo it will work unchanged on all future Pharo versions? I imagine one of the liberating aspects of VMs is that they can evolve, even incompatibility, because old software can continue to run on old VMs. But I am new to Smalltalk/Pharo culture so please educate me. Maybe we need a GL3ViewportMorph to live along side GLViewportMorph. As for plans for OpenGL support, normal and accelerated GUIs, I am working in OSWindow. I have read a little of this -- very exciting! OSWindow provides support to manage native operating system windows purely from image side. With Igor, we made a custom image and VM for Linux in which we removed almost everything graphic related from the VM. The only support needed in the VM is a small check for event presence in the VM heartbeat. For OSWindow, we made initially a XLib based back-end. To reduce maintenance efforts for Windows and Mac OS, I made a new backend based in SDL2. It is quite complete and I have tested mostly in Linux. For Windows I could make it work, not perfect so it needs more testing and a complete removal of the old Win32 drivers. I don't have a Mac for testing, but Alex is going to help me there. If there is something I can do to help with the Mac I would like to. I have to tell the CMakeVMMaker to also build SDL2 before building, instead of having to build/install it manually. After that I think that we can start integrating into Pharo 4. As for OpenGL, SDL2 gives me a multi-platform abstraction for creating a window with an OpenGL context. I already made it work with NBOpenGL, the only tricky part is dependency order when loading the stuff in the image. Yes, SDL2 is the way to go. In fact, I already started making a new 3D graphics engine Pharo, to rewrite Roassal 3D on top of this one in the near future. Soon I will be posting some screen-shots of this engine. Sounds interesting! With this graphics engine, I am also going to try to make an Athens backend, for accelerated vector graphics. Vectorial graphics with OpenGL are very hard to do fast, specially self intersecting bezier curves. Stencil based testing is simple, fast, supported and efficient for this job. Very nice. Is Athens used to render the main UI elements (windows, buttons, bitmaps, text, etc?). It's not clear to me how the OSWindow work will result in a faster Pharo UI. On OSX, at least, underneath everything is already an OS window that supports GL and other accelerated calls but the Pharo graphics primitives don't take advantage of this. Won't they need reworking? Greetings, Ronie 2014-05-30 11:10 GMT-04:00 Sean P. DeNigris s...@clipperadams.com: darrinm wrote Oh, and NBMacGLConstants is lacking necessary constants. Is it manually created or generated somehow? - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/OpenGL-3-0-tp4760914p4761009.html Sent from the Pharo Smalltalk
[Pharo-dev] RBSmalllintCheckercheckClass:
Hi guys. I have 1 important question about RBSmalllintCheckercheckClass: In Pharo 2, implementation performs: environment definesClass: aClass while in Pharo 3 it’s: environment includesClass: aClass This means that in Pharo 3 we check classes that are not defined in the environment but only contain classes which environment extends. Is this correct? Uko
Re: [Pharo-dev] RBSmalllintCheckercheckClass:
Hi guys. I have 1 important question about RBSmalllintCheckercheckClass: In Pharo 2, implementation performs: environment definesClass: aClass while in Pharo 3 it’s: environment includesClass: aClass This means that in Pharo 3 we check classes that are not defined in the environment but only contain classes which environment extends. Is this correct? No idea. Did you check the implementation of defines and includes?
Re: [Pharo-dev] OpenGL 3.0+
Ronie what would be good is to build milestones so that other people can play with it and demo it. So a solution even not working perfectly is better than a not working one. Stef On 31/5/14 01:06, Ronie Salgado wrote: Hello, I am also interested on this topic. For what I saw from NBOpenGL, Igor was generating the bindings from older specifications of the OpenGL API. Those older specifications are in a deprecated DSL. The newer versions of the OpenGL APIs are available in some XML files provided by Khronos Group. In this link http://www.opengl.org/registry/#specfiles another link for a subversion repository( https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/ ) with those XML files is available, along with the formal OpenGL specs. Because they are now in those XML files, we need new generator for OpenGL 3.3-4.0. Another question, a core profile context is really needed? Why not starting working with a compatibility profile?. OpenGL API deprecation does not depend on us, it depends on what the Khronos Group and the graphics card maker decide to do. In the x86 Desktop, the three big companies cannot remove the compatibility profile, otherwise lot of older video-games will stop working. Also, there are lots of graphic cards, specially older integrated in laptops that are only OpenGL 2.x. A better bet is to support at least the subset available in OpenGL 2.x that is also available in the core profile. As for plans for OpenGL support, normal and accelerated GUIs, I am working in OSWindow. OSWindow provides support to manage native operating system windows purely from image side. With Igor, we made a custom image and VM for Linux in which we removed almost everything graphic related from the VM. The only support needed in the VM is a small check for event presence in the VM heartbeat. For OSWindow, we made initially a XLib based back-end. To reduce maintenance efforts for Windows and Mac OS, I made a new backend based in SDL2. It is quite complete and I have tested mostly in Linux. For Windows I could make it work, not perfect so it needs more testing and a complete removal of the old Win32 drivers. I don't have a Mac for testing, but Alex is going to help me there. I have to tell the CMakeVMMaker to also build SDL2 before building, instead of having to build/install it manually. After that I think that we can start integrating into Pharo 4. As for OpenGL, SDL2 gives me a multi-platform abstraction for creating a window with an OpenGL context. I already made it work with NBOpenGL, the only tricky part is dependency order when loading the stuff in the image. In fact, I already started making a new 3D graphics engine Pharo, to rewrite Roassal 3D on top of this one in the near future. Soon I will be posting some screen-shots of this engine. With this graphics engine, I am also going to try to make an Athens backend, for accelerated vector graphics. Vectorial graphics with OpenGL are very hard to do fast, specially self intersecting bezier curves. Stencil based testing is simple, fast, supported and efficient for this job. Greetings, Ronie 2014-05-30 11:10 GMT-04:00 Sean P. DeNigris s...@clipperadams.com mailto:s...@clipperadams.com: darrinm wrote Oh, and NBMacGLConstants is lacking necessary constants. Is it manually created or generated somehow? - darrinm - Cheers, Sean -- View this message in context: http://forum.world.st/OpenGL-3-0-tp4760914p4761009.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.