AW: [Mono-devel-list] String constants and localization
Dietmar Maurer
dietmar at ximian.com
Mon Jul 14 10:03:25 EDT 2003
> A saving of SuggestionKey * 7 (with the settings of the
> second example) would in reality mean a saving of about 70%
> TOTAL size (including the
> translation)
> In the first example we would save about 60% size
>
> Also for extremely memory limited devices you probably can
> remove the enumeration completely after compiling (all enum
> members are compiled into int's), which increases savings even more.
>
> All that I stated now are just savings in assembly size. At
> runtime the savings are EVEN HIGHER! At runtime Mono should
> never need to access the enumeration keys (everything is int
> now) so the need for RAM is probably about 80% LESS than the
> current solution!!!! That all with more programing safety and
> much higher access speeds at much lower CPU usage.
I cant really follow your argumentation. Here is a simple example:
LDSTR "A TestString";
call String translate_string (String);
This is everything required to translate a String, its about 10 bytes IL
code plus additional bytes to store the String, which is strlen*2 because we
use ucs2 for strings.
The question is howto impl. translate_string:
1.) The simplest solution is to return the string passed (no translation at
all)
2.) It can be done like with gettext (info gettext - MO Files). With that
format its possible to store a hash table, so lookups should be quite fast.
It should be possible to impl. lookups efficiently - you only need to load
the required strings.
I dont see where we waste much memory?
The advantage of a gettext like approach is that you have the real messages
inside your Code. There is no need to use integers, enumeration, or any
other kind of tag.
- Dietmar
More information about the Mono-devel-list
mailing list