1. 3.1 -> 4.0 Sample Case -- lines.ex
- Posted by jeremy (admin) Nov 17, 2010
- 1280 views
Today I was cleaning up some demos and decided to take the lines.ex program and just see how much we would save by converting it to use new language constructs and the new standard library. I knew we would save a good deal, but what we did save blew me away. During the process I actually fixed a few bugs, gave better help output and added a new feature (now displays % of code commented). In the end?
Old: 591 Lines
New: 195 Lines
That is 33% of the size, i.e. 66% of the old program is gone! This is stripping no features, only adding features and fixing bugs.
The old program can be seen at: hg:euphoria/file/1eb5b6dfb62a/bin/lines.ex and the new lines program can be seen at: hg:euphoria/file/a80bc56102c7/bin/lines.ex.
Now, not to over sell 4.0, this was a utility program of minimal size. As the program size goes up, boiler plate code % and utility code % goes down, thus typically the larger the program the less over all you will cut. But, none the less, going from 591 LOC to 195 LOC is pretty impressive.
Have fun with 4.0!
Jeremy
2. Re: 3.1 -> 4.0 Sample Case -- lines.ex
- Posted by kinz Nov 18, 2010
- 1192 views
Old: 591 Lines
New: 195 Lines
What a mysticism? The lines.ex of 3.1.1 is just 108 lines ...
kinz
3. Re: 3.1 -> 4.0 Sample Case -- lines.ex
- Posted by ChrisB (moderator) Nov 18, 2010
- 1143 views
Hi
Lines.ex from 3.1.1 counted only the lines within the program name that was supplied. Lines.ex was update when eu 3.x became open source, and has remained so until Jeremy's update. It now gives a line count of all the lines within your program, including all the includes that you use. This has been the case for several years. Just another of those poorly documented treasures waiting to be unearthed.
Cheers
Chris
4. Re: 3.1 -> 4.0 Sample Case -- lines.ex
- Posted by jeremy (admin) Nov 18, 2010
- 1127 views
Old: 591 Lines
New: 195 Lines
What a mysticism? The lines.ex of 3.1.1 is just 108 lines ...
Oh! I see. My bad. Lines was modified for a later 3.x release that was never released. The lines.ex I built from has quite a bit more functionality than what was released in 3.1.1. It contains the ability to traverse an entire program. For example:
include helper1.e include helper2.e ? 20
lines -i myprog.ex
would parse myprog and all include files outputting a true line count for your euphoria program, including nested includes all the way down the line, i.e. if helper1.e included myseq.e and myseq.e included libxyz.e, etc....
Jeremy