Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: New competition: do you accept the challenge?! :-)

From: kpeters:otaksoft at: 7-Nov-2007 10:46

Hi all ~ Steeve's= implementation clocks in at 5.8 seconds on one of mymachines. I had read= somewhere (maybe on that Euphoriais= supposed to have very fast= string processing for an interpreted language (I remember a claim that its= version of awk beat the original awk written in C hands= down). So I asked the= folks over there for a version in compliance with Alessandro's= (on the same= machine it is about 1.5 seconds faster than Steeve's): -- start of program= -- sequence= str sequence= finale atom= st,et puts(1,"START...\n") st == time() finale == ""   =   for i=1 to 10000= do   --Initialize the temporary string   str == ""   for j= 1 to 500 do   =   -- append the string repesentationsof i and j   =   str &sprintf("%d,%d-",{i,j})   end= for   --= Append the firstfour characters of the temp str to the= result   --= java zero based   = finale &= str[2..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= -- They seem to have a= few acesup their sleeves with their sequence implementation - it= looks deceivingly simple, but packs a punch. Haven't tried their= To-C translatorwhich should give another big boost. I also don't know= if the code above could be optimized any more without violating= Alessandro's stipulations... Cheers, Kai