performance comparison

D

David Ross

For me, programming languages are like tools. A
good tradesman uses the
right tools for the job. The right tool is the one
that makes works best
to achieve the desired outcome. A bad tradesman only
is best described as
the one who uses a hammer to put in a screw, 'cause
they only know how to
use hammers, not screw drivers.

Ofcourse, real programmers use microcode, ASM and
FORTH.

This is where I don't understand most people. You can
use any language(scripting or non-scripting) to make
what others consider overkill. Making usage of
available libraries is a good start. Most quit at the
mark of not knowing how to use a library. This is 201%
untrue. You can use C for anything you use ruby on.
I will use C as an example here. you can make a
gigantic application faster in C than ruby iff you
have proper libraries. One design I like about Ruby is
that it takes less time to write code and complete an
application. Well guess what, you can do the same with
C if you had a nice set of libraries. I am sure most
people talk bad about C are not professional at all.
Think of C not as a hammer, but as an Anything Object.
It can be used for anything(unless you need to pass
assembly to unlock processor code). Restricted
languages which you could not add to would be
considered a hammer, or a screw driver. I think this
explaination pretty much ruins the idea of C being a
hammer, which sounds rediculous in the first place.

----------------------------------------
-- Name: David Ross
-- Phone: 865.539.3798
-- Email: drossruby [at] yahoo [dot] com
----------------------------------------




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
 
A

Alexey Verkhovsky

Test/Unit Reporter publishes results of test/unit test suite execution
in HTML and other formats.

Current implementation includes two formatters:
* HTML formatter produces an HTML report. Sample report for Rake unit tests can be seen here: http://test-report.rubyforge.org/rake-report/index.html

* XML formatter formats test suite results in an XML file, using the
same format as Ant junit task. This output then can be passed to Ant
junitreport task to produce an HTML report, or otherwise
analyzed/processed with an XML parser.

You can download Test/Unit Reporter from
http://rubyforge.org/projects/test-report/

Hopefully some people will find it useful.

Since this is my first open-source Ruby project, packaging in this
release is spartan ("non-existent" may be more accurate). I am willing
to put some effort into it, but it's a lot of gadgets to learn. Any help
or advice from someone with expertise in these matters would be highly
appreciated.

Best regards,
Alexey Verkhovsky
 
B

Bill Guindon

Test/Unit Reporter publishes results of test/unit test suite execution
in HTML and other formats.

Current implementation includes two formatters:
* HTML formatter produces an HTML report. Sample report for Rake unit tests can be seen here: http://test-report.rubyforge.org/rake-report/index.html

* XML formatter formats test suite results in an XML file, using the
same format as Ant junit task. This output then can be passed to Ant
junitreport task to produce an HTML report, or otherwise
analyzed/processed with an XML parser.

You can download Test/Unit Reporter from
http://rubyforge.org/projects/test-report/

Hopefully some people will find it useful.

Very nice! I'm just starting to play with Test::Unit, and this'll be
a nice addition to my toolkit.
I've never set up a test suite before, but I managed to figure it out,
and it looks great.

btw... seems you left out a require on the mini-doc page:
require 'test/unit/ui/console/testrunner'
 
M

Mark Hubbart

This is where I don't understand most people. You can
use any language(scripting or non-scripting) to make
what others consider overkill. Making usage of
available libraries is a good start. Most quit at the
mark of not knowing how to use a library. This is 201%
untrue. You can use C for anything you use ruby on.
I will use C as an example here. you can make a
gigantic application faster in C than ruby iff you
have proper libraries. One design I like about Ruby is
that it takes less time to write code and complete an
application. Well guess what, you can do the same with
C if you had a nice set of libraries. I am sure most
people talk bad about C are not professional at all.
Think of C not as a hammer, but as an Anything Object.
It can be used for anything(unless you need to pass
assembly to unlock processor code). Restricted
languages which you could not add to would be
considered a hammer, or a screw driver. I think this
explaination pretty much ruins the idea of C being a
hammer, which sounds rediculous in the first place.

As someone who has done plenty of woodworking and carpentry, I submit
that all programming languages are like saws. One might be a handsaw,
one a tablesaw, one a handheld circular saw... and so on. Some saws
(like a jigsaw) can really only be used properly for specific purposes,
but other saws (a handsaw, for instance) can be used for pretty much
anything.

But still, you would never see someone cutting out parts for a row of
cabinets with their handsaw. And if you see someone cutting out a
picture frame with a jigsaw, you *know* they don't know what they're
doing. It's important to choose the most appropriate tool for the job.

So you might compare the choice between C and Ruby to the choice
between a handsaw and a tablesaw. C does a nice job and you can use it
for almost anything, but in many cases it isn't appropriate. If you are
creating a short program that copies files or filters text, perhaps
Ruby (or one of those *other* languages) is a more appropriate tool for
your job. If you are doing intense data processing, and speed is an
issue, you might turn to C.

I suspect that eventually, someone will come up with a language that
separates algorithms from procedures, in a way that allows better
optimizations for number-crunching parts of the code. But this
"Universal Saw" is a ways off, I'm sure. It would need to allow the
programmer to dynamically (and transparently) trade ease of coding for
extra runtime speed.

cheers,
Mark

----------------------------------------
-- Name: David Ross
-- Phone: 865.539.3798
-- Email: drossruby [at] yahoo [dot] com
----------------------------------------




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
 
Z

Zev Blut

Hello,

Try "irb --noprompt".

To me, the biggest problem with using irb in this mode is the "set up
some context" part.

Believe it or not, but it is quite easy to do with Eclipse/Java: one can
set a breakpoint, execute some test, wait till debugger stops on the
breakpoint, and then use Eclipse "Display" view to evaluate arbitrary
Java expressions in the current scope.

So far, I don't know any easy way to do the same with Ruby, so I end up
inserting things like "puts <expression>.inspect" and rerunning the
test. Which is not as nice as an interactive shell. Does anyone have a
better way?

In addition, to Florian Gross' nice technique, you could also use the
Ruby Debugger instead of IRB.
Just run your program with "ruby -r debug yourprog.rb". Even better,
if you use Emacs, is the ruby debugger mode for it "M-x rubydb".
Of course, this is not as transparent as Eclipse...

Cheers,
Zev
 
Z

Zev Blut

Hello,

And a huge problem is that copying code fragments into IRB is easy but
if you want to get some code you typed in IRB multiple lines) getting
this back to the editor is much more difficult.

If you are not afraid of a bit of text cutting, then it is not that
difficult.

Here is a simple addition to IRB that will save your session to a
file. Add this to your .irbrc file and when you want to save what you
have done to disk type "IRB.save_session("your_filename")".

# An extension to IRB to save the session to a file
# filename: is the name of the file to save the session in
# hide_IRB: is a command to suppress output of IRB class method calls.
# to prevent execution of the session in Ruby from giving errors.
def IRB.save_session(filename,hide_IRB=true)
file = File.open(filename,"w")
file.puts "# Saved IRB session for #{Time.now}",""
Readline::HISTORY.each do |line|
next if line =~ /^\s*IRB\./ && hide_IRB
file.puts line
end
file.close
end

Something like this may have been mentioned before, but if not I hope
someone finds it useful.

Best,
Zev
 
M

Mark Probert

David Ross said:
You can use C for anything you use ruby on.
Of course you are right. Ruby is written in C .. QED.

I am sure most
people talk bad about C are not professional at all.

Ever worked as a maintenance programmer? Ever fixed bugs that other
engineers had introduced into the code? Ever found that some of those
bugs where simple stuff, like array bounds violations or null pointer
assignments? Then, have you tried going up to the original coder and
telling them that they are not professional?

There are better ways of coding in C. Try, for example

http://www-cs-faculty.stanford.edu/~knuth/cweb.html

There are better ways of improving in any language

http://www.sei.cmu.edu/tsp/psp.html

Both of these approaches have been used by People Who Know A Lot (Knuth
and Humphries) and both have been shown to work (I've used both and know
they work).

Why do more people not use them? Why is our code still riddled with
basic errors?

(Hint: it has nothing to do with the language, though the language will
have an impact. C is less, errrr, helpful, to the less experienced).
 
D

David Ross

--- Mark Probert said:
Of course you are right. Ruby is written in C ..
QED.



Ever worked as a maintenance programmer? Ever fixed
bugs that other
engineers had introduced into the code? Ever found
that some of those
bugs where simple stuff, like array bounds
violations or null pointer
assignments? Then, have you tried going up to the
original coder and
telling them that they are not professional?

There are better ways of coding in C. Try, for
example


http://www-cs-faculty.stanford.edu/~knuth/cweb.html

There are better ways of improving in any language

http://www.sei.cmu.edu/tsp/psp.html

Both of these approaches have been used by People
Who Know A Lot (Knuth
and Humphries) and both have been shown to work
(I've used both and know
they work).

Why do more people not use them? Why is our code
still riddled with
basic errors?

(Hint: it has nothing to do with the language,
though the language will
have an impact. C is less, errrr, helpful, to the
less experienced).

I agree on all points. It is humans who make errors.
To the experienced C is bliss. (* and assembly) (*even
if there is some stress figuring out what is wrong in
the program). After swearing some and hitting the
computer a few times it is okay. Oh and making fun of
the original code and all the bad hacks they did to
make the code work. (=

--David Ross




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
 
L

Lothar Scholz

Hello Mark,

MP> There are better ways of coding in C. Try, for example

MP> http://www-cs-faculty.stanford.edu/~knuth/cweb.html

Sorry but the hole idea of literature programming is one of the most
stupid thing i've ever seen in the world of programming.
It does not work and it shows again that Donald E. Knuth is living in a
galaxy far far away.

Adding the redundancy and ambiguity of natural languages is making
the problem worse. Real programs change a lot and under time pressure.
Don't count extensive API specification, because this has nothing to do
with Knuth's CWeb (literate programming).

MP> There are better ways of improving in any language

MP> http://www.sei.cmu.edu/tsp/psp.html

MP> Both of these approaches have been used by People Who Know A Lot (Knuth
MP> and Humphries)

Sorry i doubt that Knuth has real world experience. Even with a high
IQ a person can be a huge fool - by the way: what was the name of the
chess player with the IQ 180 that is arrested in Japan at the moment ?

MP> and both have been shown to work (I've used both and know
MP> they work).

????????
Can you give me one example of a larger program that uses the CWeb
style, lets make it easy and say something with more then 100.000 lines
(a medium scale project) ?

Humphries "Personal Software Process" is nice but has nothing to do with
programming styles or languages. Its a way to get a better time management and
reliable feedback of your tasks. It's all about measuring what is
going wrong and how much you spend for fixing it.
In the later chapters of his Ph.D. he describes things like formal verficiation
etc. but this is AFAIK not part of the PSP.

MP> Why do more people not use them? Why is our code still riddled with
MP> basic errors?

I don't know. I'm using Eiffel.

MP> (Hint: it has nothing to do with the language, though the language will
MP> have an impact. C is less, errrr, helpful, to the less experienced).

Maybe you should read Humphries again. It is about getting your error
rate lower, by finding out which are your problem areas. But he does not
say that you can avoid all errors. He is not that stupid.
And he misses also one special point: Humans are Humans, not constant
working roboters, If you had a bad night, no sex for a month or are
thinking about some stock options while working, you make errors,
exactly this errors that he thinks can be avoided with his
techniques. Read the book from Neil Postman:

Technopoly: The Surrender of Culture to Technology
http://tinyurl.com/3kqe5

and you can find some reasons why his (Humphries) point of view must
be seen as helpful but not as a solution.
 
M

Mohammad Khan

Hello Mark,

MP> There are better ways of coding in C. Try, for example

MP> http://www-cs-faculty.stanford.edu/~knuth/cweb.html

Sorry but the hole idea of literature programming is one of the most
stupid thing i've ever seen in the world of programming.
It does not work and it shows again that Donald E. Knuth is living in a
galaxy far far away.

Adding the redundancy and ambiguity of natural languages is making
the problem worse. Real programs change a lot and under time pressure.
Don't count extensive API specification, because this has nothing to do
with Knuth's CWeb (literate programming).

MP> There are better ways of improving in any language

MP> http://www.sei.cmu.edu/tsp/psp.html

MP> Both of these approaches have been used by People Who Know A Lot (Knuth
MP> and Humphries)

Sorry i doubt that Knuth has real world experience. Even with a high
IQ a person can be a huge fool - by the way: what was the name of the
chess player with the IQ 180 that is arrested in Japan at the moment ?

I think you are talking about Bobby.
BTW, his IQ 180 doesn't mean he started with IQ 180 from birth and will
continue till death. IQ varies from time to time.


Thanks
Mohammad
 
M

Mark Probert

Hi, Lothar.

Lothar Scholz said:
Sorry but the hole idea of literature programming is one of the most
stupid thing i've ever seen in the world of programming.
Ok. It doesn't work for you. I assume that you have tried it then?
Adding the redundancy and ambiguity of natural languages is making
the problem worse. Real programs change a lot and under time pressure.
I am not sure that you understand LP very well. However, this really is
the time or place for that. Some people love it, others don't. Some
like C, Ada, Modula-2 and FORTH. It doesn't really matter.
Can you give me one example of a larger program that uses the CWeb
style, lets make it easy and say something with more then 100.000
lines (a medium scale project) ?
TeX

Humphries "Personal Software Process" is nice but has nothing to do
with programming styles or languages. ...
Maybe you should read Humphries again. It is about getting your error
rate lower, by finding out which are your problem areas.
True, it is language neutral. The point is that, irrespective of
language -- C, Ruby, ASM, Eiffel -- people will make errors. PSP will
help lower the error rate regardless of the medium. To me, that is step
forward.
 
L

Lothar Scholz

Hello Mark,

MP> Hi, Lothar.

MP> Ok. It doesn't work for you. I assume that you have tried it then?

I looked at it about 10 years ago.
MP> TeX

Don't now enough about Tex to be sure that is a real world project,
but i deeply doubt that.
AFAIK it's not developed by multipe persons that change over time. And
did it really change a lot in the past.

MP> True, it is language neutral. The point is that, irrespective of
MP> language -- C, Ruby, ASM, Eiffel -- people will make errors. PSP will
MP> help lower the error rate regardless of the medium. To me, that is step
MP> forward.

Only as an education/training method. For experts it does not reduce
the error rate.
 
M

Mikael Brockman

David Ross said:
I agree on all points. It is humans who make errors.
To the experienced C is bliss. (* and assembly) (*even
if there is some stress figuring out what is wrong in
the program). After swearing some and hitting the
computer a few times it is okay. Oh and making fun of
the original code and all the bad hacks they did to
make the code work. (=

I love C. I think it's great for implementing designs. On the other
hand, it makes you do a lot of up-front work to get anything running.
That doesn't really encourage you to be agile. But to create original
software, you have to sketch a lot. Often you won't even know what you
want to create. You have to figure that out as you go.

Dynamic & high level languages attach less cost to changing. They
encourage you to experiment. That's not very valuable if you're just
implementing something you designed up-front. But it's absolutely
essential if you're not.

Using C to create original software isn't bliss. It's like being in a
straight-jacket. But considering you're a fan of Ada, I guess you like
that kinda stuff.
 
M

Mauricio Fernández

Test/Unit Reporter publishes results of test/unit test suite execution
in HTML and other formats. [...]
You can download Test/Unit Reporter from
http://rubyforge.org/projects/test-report/

Hopefully some people will find it useful.

Since this is my first open-source Ruby project, packaging in this
release is spartan ("non-existent" may be more accurate). I am willing
to put some effort into it, but it's a lot of gadgets to learn. Any help
or advice from someone with expertise in these matters would be highly
appreciated.

One of the premises of the Ruby Production Archive (RPA) is that the
developers need not package for RPA, RPA packages for them[1] ;-)
I have therefore just uploaded it to the preliminary Ruby Production
Archive repos., for use with rpa-base (http://rpa-base.rubyforge.org),
so that it can be installed now with
rpa install test-report

I will try to keep it up-to-date as you release new versions.

FYI, packaging it for with rpa-base essentially involved writing the
following 'rpafied install.rb' file:

require 'rpa/install'

class Install_test_report < RPA::Install::FullInstaller
name "test-report"
version "0.1.0-1"
classification Library
build do
installrdoc %w[README] + Dir["lib/**/*.rb"]
installexamples "test"
skip_default Installtests
end
description <<EOF
Report the results of a unit test run in HTML and other formats.

The current implementation of test-report includes two formatters:
* an XML formatter which outputs test suite results into an XML file, using
the same format as a Ant junit task. This output can then be passed to an
Ant junitreport task to produce an HTML report.
* an HTML formatter which produces an HTML report.
EOF
end


You are not expected to maintain it or anything, so please don't
complain about the lack of docs yet ;-)

[1] at this point a 'soviet Russia'-style joke is tempting; it's been so long
since I quit /. that I don't know if it's in anymore.
 
B

Barry Sperling

I believe that Knuth invented and programmed Tex. I wish that I could
do half as well.
 
M

Mikael Brockman

Lothar Scholz said:
Hello Mark,

MP> There are better ways of coding in C. Try, for example

MP> http://www-cs-faculty.stanford.edu/~knuth/cweb.html

Sorry but the hole idea of literature programming is one of the most
stupid thing i've ever seen in the world of programming.
It does not work and it shows again that Donald E. Knuth is living in a
galaxy far far away.

Indeed. For one, he's a genius and you're not. He's a technical writer
with the Bible under his belt. You can't say ``it does not work'',
because it provably does: just look at TeX.
Adding the redundancy and ambiguity of natural languages is making
the problem worse. Real programs change a lot and under time pressure.

A specific subset of ``real programs'' do. TeX doesn't.
Sorry i doubt that Knuth has real world experience.

Conjuring into existance two different worlds and putting your opponent
in the unworthy one is a very clever trick. Actually, the phrase ``real
world'' has nearly become an argument in itself. You can use it to
disqualify anything. How convenient!
Even with a high IQ a person can be a huge fool

Of course, but why do you suppose this is the case with Knuth? Has CWEB
not worked for TeX?
Can you give me one example of a larger program that uses the CWeb
style, lets make it easy and say something with more then 100.000 lines
(a medium scale project) ?

If you can't answer this question yourself, I don't think you're
qualified to say zip about Knuth.
 
K

Kristof Bastiaensen

Hello Mark,

MP> Hi, Lothar.

It is called literate programming.
MP> TeX

Don't now enough about Tex to be sure that is a real world project, but
i deeply doubt that.
AFAIK it's not developed by multipe persons that change over time. And
did it really change a lot in the past.

People are still using TeX, more than 20 years after it was written. I
find that pretty amazing for a user-program. If it doesn't qualify as a
real world project then I don't know what does. I wonder if people would
be still using the software that you write now over 20 years (I doubt it).

Maybe we should be very grateful that Knuth isn't writing what you
call "real world programs". Did you ever have a look in "The Art
of Computer Programming"?
MP> True, it is language neutral. The point is that, irrespective of
MP> language -- C, Ruby, ASM, Eiffel -- people will make errors. PSP
will MP> help lower the error rate regardless of the medium. To me, that
is step MP> forward.

Only as an education/training method. For experts it does not reduce the
error rate.

Regards,
KB
 
D

David Ross

I love C. I think it's great for implementing
designs. On the other
hand, it makes you do a lot of up-front work to get
anything running.
That doesn't really encourage you to be agile. But
to create original
software, you have to sketch a lot. Often you won't
even know what you
want to create. You have to figure that out as you
go.

I always spend a couple weeks on design before coding.
I refuse to code even one line before design. Its the
way I work.
Dynamic & high level languages attach less cost to
changing. They
encourage you to experiment. That's not very
valuable if you're just
implementing something you designed up-front. But
it's absolutely
essential if you're not.

Right, experimentation with the dynamic and latest
generation high level languages lead to more knowledge
in the computer science field. Some of the latest
achievements

Can you explain what you mean by up-front?
Using C to create original software isn't bliss.
It's like being in a
straight-jacket. But considering you're a fan of
Ada, I guess you like
that kinda stuff.

Programming in C or Ada isnt bad at all. The knowledge
is great to know. I have been learning programming and
scripting languages for a long time. I have been
through a lot and I see what I see. I know what I read
and experiment on how I can be faster. It really is
bliss though. When programming in per say C, I don't
have to think what I am doing at all, except make sure
that I am not writing buggy code which might have an
exploit.

As far as the striaght jacket goes.. I probably need
one since I am a crazy programming kook.

I would eventually like to get a Ruby compiler going.
I will have to rename rubycc to something else. I do
not plan on converting Ruby to C code. I plan on
learning the internals of Tendra (tendra.org, not the
ten15 fork) and I will try to make a massive runtime.
8) Will be Ruby to machine code. (*oh yes Lothar, I
know I am crazy)

Programming in C is nice to experience. Other
languages like Scheme, Lisp, Ada, Eiffel, and
Smalltalk are nice languages to practice in as well.
Each language gives you some form of thought and
increases your performance in other languages.

Oh all the pitfalls and inconviences. Oh my! =)

--David Ross




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top