Re: How fast is Euphoria's string processing?

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

Kai wrote:
> 
> Hi all ~
> 

> I was wondering if one 
> could whip up the equivalent in Euphoria for comparison purposes?

-- start of program --
sequence str
sequence finale
atom st,et

puts(1,"START...\n")
st = time()
-- Initialize the result to an empty string
finale = ""
        
-- repeat for 10,000 times
for i=1 to 10000 do
    -- Initialize the temporary string
    str = ""
    -- repeat for 500 times
    for j = 1 to 500 do
        -- append the string repesentations of i and j 
        str &= sprintf("%d,%d-", {i,j})
    end for
    -- Append the first five characters of the temp str to the result
    finale &= str[1..5]
end for
et = time()
puts(1, "COMPLETED!!!\n")
printf(1, "%s\n%d\n%f seconds\n", {finale, length(finale), et-st})
-- end of program --


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu