180 likes | 308 Views
Pavel Boytchev E UROLOGO 2005, W ARSZAWA 27-31 A UGUST 2005. Motivation. Faster execution interpreter developers make their best execution of more complex programs encourage soon-to-become-professional programmers Single file policy It is hard, deadly hard
E N D
Pavel Boytchev EUROLOGO 2005, WARSZAWA 27-31 AUGUST 2005
Motivation • Faster execution • interpreter developers make their best • execution of more complex programs • encourage soon-to-become-professional programmers • Single file policy • It is hard, deadly hard • preserving the core Logo features • looking for another challenge • obviously I'm a masochist in software development
Basic Features • Instruction set based on UCBLogo • Written in GCC • Extremely fast • May compile and execute at run-time • Default in-memory compilation and execution • Can create executable files or assembly dumps • Internal tests for memory leaks
Primitives • Support of 120+ primitives • all numeric functions • all word/list functions • all queries, operators • program control commands (repeat, while, for, …) • nested to…end, goto, run • Minor differences • for "i [1 10] […] • while not empty? :x […] • printwidthlimit 100
Performance • Test environment Pentium 4, 2.8GHz, 512MB RAM, Windows XP Home • Compared Logos • UCBLogo 5.3 standard performance 1.00 • MSWLogo 6.5b • aUCBLogo 4.66 • Imagine 2.0 Demo • Elica 5.4 • Lhogho • Validity of benchmark results
Arithmetic Benchmark - 1 109 1 — Calculate: n n=1 • 1,000 = 103 • 10,000 = 104 • 100,000 = 105 • 1,000,000 = 106 • 10,000,000 = 107 • 100,000,000 = 108 • 1,000,000,000 = 109 • make "s 0make "n 1 • repeat????[make "s :s+1/:nmake "n :n+1] Time limit : from 1 to 1,000 seconds
Arithmetic Benchmark - 2 • 1st place: Lhogho 26.8 times faster • 2st place: Imagine 2.6 times faster • 3st place: aUCBLogo 2.3 times faster • Comments: • Only Lhogho can calculate up to 109 members • Other Logos processed only 106~108 members • Compiled code is much faster than interpreted • Access to stack addresses is cruitial • Mainstream Logos provide similar performance
List/Memory Benchmark - 1 Create a list of 10 million distinct elements and then reverse the list • 1,000 = 103 • 10,000 = 104 • 100,000 = 105 • 1,000,000 = 106 • 10,000,000 = 107 • make "n ????make "a [ ]repeat :n[make "a fput :n :a make "n :n-1] • make "b [ ]while notempty? :a[make "b fputfirst :a :bmake "a bf :a] Time limit : from 1 to 120 seconds (due to memory swap activities)
List/Memory Benchmark - 2 • 1st place: Lhogho 22.6 times faster • 2st place: aUCBLogo 1.4 times faster • 3st place: UCBLogo 1.0 • Comments: • Only Lhogho can handle list with 107 members • Other Logos processed only 103~106 members • Compiled code is much faster than interpreted • Memory manager is cruitial for performance • Mainstream Logos provide similar performance
1 1 1 1 1 1 1 1 1 a = c = b = — + — + — + ... — + — + — + ... — + — + — + ... 1 4 7 3 6 9 2 5 8 Indirect Access Benchmark - 1 107 1 — Calculate: dynamically distributed into 3 variables: n n=1 • make "a 0make "b 0make "c 0make "v "abcmake "n 0repeat????[make "n :n+1make "w first :vmake "v wordbf :v :wmake :w (thing :w)+1/:n] • 1,000 = 103 • 10,000 = 104 • 100,000 = 105 • 1,000,000 = 106 • 10,000,000 = 107 Time limit : 1,000 seconds
Indirect Access Benchmark - 2 • 1st place: Lhogho 3.8 times faster • 2st place: aUCBLogo 2.3 times faster • 3st place: UCBLogo 1.0 • Comments: • Lhogho advantages not so obvious when run-time compilation overhead is done millions of times • In some extreme dynamic cases interpretation may become faster then run-time compilation • All Logos provide similar performance
Evolutionary Concepts • Lhogho is a child of incompatible parents.Is it possible? • Lhogho = DNA of all Logo chromosomes • compiling = giving birth to a child, which inherits parent's chromosomes • children are NOT identical to parents • able to give birth to other Lhogho children • What about professional compilers? • compiling = giving birth to a mule (dies without issue)
Using Evolution • We have: • original compiler Lhogho.exe • source of a Logo library Lib.lgo • We compile Lib.lgo into Lib.exe • Now we have Lib.exe which: • is again a Lhogho compiler, but • enriched with the new definitions from Lib.lgo • We can use Lib.exe: • to compile Lhogho programs that need Lib functions • to create even richer compilers - legatees of Lhogho
Future Work • Implementing the full set of instructions • Traditional graphical commands • Non-traditional graphical commands • Environment
That’s All Folks That’s Not All Folks
About the Name Lhogho • Unpronounceable word, not found on the web • Simplified ASCII version of the original true Lhogho name:
Quizz Q: When is Lhogho … conceived? A: August 30th, 2004 Q: What is the size of ... the picture? A: 40kb Q: What is the size of ... the Lhogho compiler? A: 20kb
The End Not The End