LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Your opinions of the best combination of programming languages to learn. (https://www.linuxquestions.org/questions/programming-9/your-opinions-of-the-best-combination-of-programming-languages-to-learn-813373/)

bigearsbilly 07-29-2010 03:23 AM

ruby is quite, er, slow.

pr_deltoid 07-29-2010 11:57 PM

http://www.thebuzzmedia.com/ruby-19-quick-speed-test/
Quote:

Now, it is no news that 1.9 is faster than 1.8, but an 8x improvement on this simple recursive script? I was astonished! This is better than using XRuby to speedup Ruby performance!
http://programmingzen.com/2007/12/03...ruby-shootout/
Quote:

Ruby 1.9 confirms itself as a fast implementation, about three times the speed of 1.8.6 which is going to replace it in 3 weeks. Ruby 1.9 (Yarv) is still the fastest of the lot in most tests, but others are clearly catching up. We have been waiting for a long time for this version of Ruby and it’s sure not to disappoint. A great Christmas present for Ruby lovers.
NOTE^ I'm sure they meant "which it is going to replace in 3 weeks."

bigearsbilly 07-30-2010 03:51 AM

Completely ignore my previous comment.
I updated my ruby to the 1.9 version and

I can confirm that ruby is no longer slow.


my personal test is to shuffle input lines, using fisher yates shuffle,
(which I use to randomize mp3 file names to put on a stick).

Code:

$ time ruby18 ./fisher_yates.rb 1.txt > 1
    4.05s real    3.50s user    0.53s system

$ time ruby19 ./fisher_yates.rb 1.txt > 1
    1.82s real    1.78s user    0.03s system

that is an impressive improvement!



my previous comparison was with perl...
Code:

$ time  ./fisher_yates.pl  1.txt > 1   
    1.07s real    1.04s user    0.02s system

and python:
Code:

$ time  ./fisher_yates.py <  1.txt > 1
    2.25s real    2.20s user    0.03s system

test text is "don quixote" by cervantes, split to one word per line.

Code:

$ cat 1.txt | wc -l |  commify
  433,968


MTK358 07-30-2010 07:13 AM

That's pretty impressive, from much slower than anything else to faster than Python!

pr_deltoid 07-31-2010 08:00 AM

Alright, my votes were:
C and Python.

After reading and thinking, I'm going to make my final vote:
C, C++, and Ruby or Python

I don't know the details of why Python is better than Ruby, even though I've seen it said again and again, but I've read some Python tutorials and now I'm learning Ruby and in my opinion, I would vote Ruby. It's very nice, I don't see anything wrong with it. Python's a good language, also, but I prefer Ruby.

bigearsbilly 08-01-2010 05:13 AM

interestingly (?) on my benchmark C++ may blitz the scripting languages
or may not be appreciably any faster!
depending whether you use stdio or C++ streams:

using <cstdio>
Code:

$ time ./fisher_yates 1.txt > 1       
    0.14s real    0.11s user    0.03s system

using <iostream>
Code:

$ time ./fisher_yates_iostream 1.txt > 1
    1.35s real    0.62s user    0.72s system
$

very disappointing show for iostreams I feel.

bigearsbilly 08-02-2010 03:05 AM

I am so impressed I've just ordered "the ruby programming language"

Marcelo Fortes 08-09-2010 03:31 PM

ObjectPascal
 
I by myself do powerfull systems /applications in modern variants of ObjectPascal, its a pitty that this language is threated as second class citzen just becouse C/unix inventor, just did a unhappy commentin early 70'ies! Its a myth ObjectPascal is a feeble language only for educational porpuses. TIOBS list shows that interest on Pascal/ObjectPascal have been growing.

Not to mention others as Ada, Eiffel, SPARK.

Marcelo Fortes 08-09-2010 03:41 PM

Quote:

Originally Posted by fruttenboel (Post 4004656)
I'd say: Tcl/Tk and Java. Both are scripted languages. Still, they are fast enough and both are excelletn for building programs. Tcl/Tk is great for building GUI front ends, and also for 'normal' programs.
Java is the language of the future. It's the safest among the 'curly braces languages'. C and C++ are portable assemblers. And assemblers are outdated. But don't take me on my words here. C and C++ are neither assemblers nor portable. At least, not as much as the users would like them to be.

My great love in programming languages is Modula-2. It's a very safe language, like Ada, and it is certified for mission critical applications (like Ada). Alas, nobody is using it. Probably because it was made in Switzerland instead of in the US.

Java has a lot in common with C, C++ and Modula-2. It builds on the syntax of C and C++ yet has a lot of the safety issues of Modula-2 added to it. This makes the compiler type-safe. Java is cross platform and identical for every implementation. Add it all up and you have a good programming environment.

Agreed remember ObjectPascal ans Eiffel too !

bigearsbilly 08-10-2010 03:53 AM

marcelos!
java is of the future!
the past more like.

I think you may find that Tcl and Java interpreters are implemented largely in terms of
C or C++, as is perl, ruby, python, etc etc etc

I think you may find this is what is know as, reality

:)

pr_deltoid 09-14-2010 10:26 AM

It's really hard for me to choose between Ruby and Python, but Python is used for so many things that it makes it seem better to me. I'd like Ruby to be as popular as Python. If it got as popular as Python, I'd probably use it instead. I don't know which one I would say is better, but Python is used so much... Ruby seems to be very nice and neat and I don't see any problems with it, and Python is getting changed around too much in my opinion (unless they stop now, after 3). But Python is so popular and commonly used for pretty much anything, that it seems like the better one to start learning.
I don't like the amount of changes between Python 2 and 3, even though I'm sure it's a big improvement. I won't care if they stop doing that after 3 or 4, but if every major release has a hundred differences, it's going to turn ridiculous. Hopefully 4 doesn't have to go through too many changes and then it's done with.

MTK358 09-14-2010 11:03 AM

I wouldn't let popularity be such a big factor.

Alexvader 09-14-2010 11:12 AM

Quote:

Originally Posted by MTK358 (Post 4097236)
I wouldn't let popularity be such a big factor.

Hi MTK358

Popularity means a larger coder base -> more resources in terms of libraries and snippets -> etc, etc.

This is like speaking/writing in a common language... I bet there are more pieces of technical / Philosophical / history / <whatever> writing in English than in Urdu... IMHO,

... so you access a bigger pool of knowledge being an English speaker, than being an Urdu speaker...

theKbStockpiler 09-15-2010 02:42 AM

It depends
 
For Linux administration you should prioritize on Bash.
For a Solid understanding of the backbone of computing you should learn C which can be expanded to object C in the future.

For more learing I recommend RISC assembly for Microcontrollers although this is a little out there for most PC users. A full assmebly language set looks like C as compared to RISC so I only think it is interesting if you only want it to use BIOS for system calls.If you are a genius I would also then learn Perl. I studied Pascal and loved it but it is harder to implement than C for embedded and other small stuff.Bite the bullet and learn C as a base Language or use Java because it is more popular for employment.:twocents:

Sergei Steshenko 09-15-2010 03:00 AM

Quote:

Originally Posted by theKbStockpiler (Post 4097942)
... I studied Pascal and loved it but it is harder to implement than C for embedded and other small stuff. ...

IIRC, full standard Pascal compiler written in Pascal is just about 5000 lines long. The point is not Pscal vs "C" complexity, but rather the fact that by design standard Pascal does not give access to memory addresses, i.e. one can't write in standard Pascal "store 5a hex at address 1234" and one can't access IO devices from standard Pascal.

I.e. Pascal was meant as an application programming (opposed to system programming) language.


All times are GMT -5. The time now is 06:34 AM.