On Mon, 27 Sep 2010, Igor Stasenko wrote:
On 27 September 2010 22:10, Levente Uzonyi <leves@elte.hu> wrote: On Mon, 27 Sep 2010, Johan Brichau wrote:
On 27 Sep 2010, at 14:37, Schwab,Wilhelm K wrote:
"Works fine" is a value judgment that can cut both ways: one could also argue that VW lacks a useful optimization of literals. Â Non-literal strings should do what you want.
I wonder how useful the optimization is, actually. Probably not many (if any) methods will use the same literal multiple times and count on the compiler to optimize them into the same literal.
I think this is from the 80's or 90's where this could save some memory. According to my calculations in Squeak 4.2 with some extra packages loaded it saves at least 36591 bytes (object size + 1 slot in the literal array), which is only 0.79 bytes / method.
Well, you can save a bit more, if you scan a whole image literals and unify them. This could be userful for tidying up the image size. Probably yes, but that's not the point I guess. I just wanted to show that the current method doesn't really save much. Unifying the literals in the image is dangerous, because literal strings are not immutable (and they shouldn't be IMHO). So that could lead to random errors if a method is modifying a shared string literal. Levente
Levente
Inversely, I have never run into that issue myself either, until I was just testing those little snippets for the students. Or... at least, I think I never have :-)
Johan _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project