Re: Profiling Under Windows & String Size

new topic     » goto parent     » topic index » view thread      » older message » newer message

Kat wrote:
>> That's it.  We want our objects to be even more dynamic
>> than they already are.
>
>Has anyone tried to use those "extra" 3 bytes for anything? Will Eu keep
>them as you set them, or change them in some way? I suspect a gui would make
>good use of them, for formating the character. What happens to those 3 bytes
>if they get swapped the the hd and back into ram?

When you create a "string" in Euphoria, such as

   "HELLO"

it is *literally* nothing more than a sequence, in this case the same as

   {72, 69, 76, 76, 79}

When written out to disk with print(), which is for writing out any
object, each value gets written completely. If you added 51200 to each
"character" (making the second byte of each value equal to 200), and
wound up with

   {51272, 51269, 51276, 51276, 51279}

you could still use print() to store each value without losing anything.

When using puts(), which treats sequences like C strings, only the lowest
of each value's 4 bytes is written... in this case, the two above
sequences would both be written out identically. You would lose the extra
bytes in the second sequence.

As far as I know, an integer sequence in Euphoria ALWAYS uses 4 bytes per
integer in RAM, so swapping to virtual memory shouldn't hurt anything.

And you don't have to worry about Euphoria making use of those "extra"
bytes either. That would be like you adding data to each "character", and
suddenly finding your altered string (really a sequence) of

   {51272, 51269, 51276, 51276, 51279}

changed into

   {72, 1000069, 7676, 33376, 790079}

Euphoria simply does not abuse your sequences that way (thank goodness!)

As for making use of the extra bytes? Might be a good idea; I don't know
for sure, but I would imagine someone has done something like that before.
(But then, I could be wrong....)


Rod

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu