Re: Eu Interpreted
- Posted by Irv Mullins <irvm at ellijay.com> Aug 14, 2001
- 460 views
On Tuesday 14 August 2001 12:50, Robert Craig wrote: > > Irv Mullins writes: > > Reading a 10,500 line text file and sorting it100 times in Euphoria takes > > 9.38 seconds, the same task in Lua takes 9.61 seconds. Making the sort > > call via "dostring" instead of direct takes 9.62 seconds. > > Correct me if I'm wrong but this benchmark > seems to consist of: > > 1. doing a bunch of I/O, where a large chunk of the time > will be spent inside the O/S, and also waiting for possible > mechanical motion of the disk. Interpreter speed is largely > irrelevant. The I/O time just dilutes the overall speed comparison. > > 2. sorting, where you compare a generic and *interpreted* shell-sort > written in Euphoria, against a quick-sort routine *written in > compiled C*, i.e. the Lua *built-in function* for "sort". > In any case, for 10,500 items, the quick sort *algorithm* should be > somewhat faster than shell sort. > > The fact that Euphoria wins the benchmark is remarkable. It certainly is. But, as you say, the disk access masks the differences. Once you take the disk access time away, the story is different. Look at this one: Convert 10,564 lines of text (from listserver archive) to uppercase: (Timing starts after text is loaded) Euphoria : 0.24 seconds Lua: 0.02 seconds ------------------- -- Filesort.lua ------------------- lines = {} readfrom("lua.txt") lines = read("*all") readfrom() start = clock() lines = strupper(lines) fini = clock() print(lines) -- to verify all is upper case print(format("%2.4f",fini-start)) -------------------- -- Filesort.exu -------------------- include wildcard.e atom fn, start, fini sequence text object line fn = open("lua.txt","r") text = {} while 1 do line = gets(fn) if atom(line) then exit else text = append(text,line) end if end while start = time() text = upper(text) fini = time() printf(1,"Time required: %2.4f",fini-start) Regards, Irv