Re: Euphoria 2.5 Features..... ??

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

Hello Mario again,

----------
> From: Mario Steele <eumario at trilake.net>
> Subject: Euphoria 2.5 Features..... ??
> 
> 
> Hello all, I'm back!
> 
> Allright, wanted to pass along a couple of ideas, and maybe run over a 
> idea like a rampid person, that tries to wear something out.  And I do 
> seriously think these would be good Ideas for Euphoria 2.5
> 
> First off, The wearing out Idea/Problem.  A String Type Variable.
> Yeah Yeah, I realize we can do custom string type variables in Euphoria, 
> but there's still 1 major problem with it all.  Even if it's a string 
> type variable,  Euphoria still allocates 4 bytes of memory to store a 
> simple 0 to 255 (Or 0 to 255*2) character into memory.  Now for little 
> baby strings, okay, that's kewl, no big loss.  But when we get into big 
> files, like for example, Win32lib _BEFORE_ the breakup into seperate 
> libraries, and still somewhat now, we get a very big memory waste for 
> all of it.  Now we all know, the interpreter doesn't allocate 4 bytes of 
> memory for each character, when reading the Plain Text euphoria code 
> into memory, for parsing, and execution.  So my quesiton is, why should 
> we have to waste memory to read a file into memory, especially big 
> files, which could double, even triple in size, when loaded into a 
> simple Euphoria Sequence.

[[snipped the solved problem]]

I do not know if someone used the trick below, 
but it seems to be useful for some new 
text routines of Euphoria without 
new char type.

--- code
include machine.e

sequence text

text = "test of packing the text into the atoms "

? text

puts(1,text)

puts(1, "\n-----     chars (integers) - ")
? length(text) 
puts(1, "\n\n\n\n")

sequence TEXT TEXT = {}

for i=1 to length(text) by 4 do
    TEXT &= bytes_to_int(text[i..i+3])
end for

? TEXT

for i=1 to length(TEXT) do
    puts(1,int_to_bytes(TEXT[i]))
end for

puts(1, "\n-----     atoms - ")
? length(TEXT) 
--- end of code

Try please, maybe it is not too bad ...

Regards,
Igor Kachan
kinz at peterlink.ru

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

Search



Quick Links

User menu

Not signed in.

Misc Menu