How Can One Language Be "Faster" Than Another If - - -


#1

If compiled languages compile down into machine code, how could any be said to be “faster” than another??

Just curious. Thanks!


#2

Even as machine code, it is still code and needs resources and cyclic actions that eat up clock ticks. Some languages perform better with certain data types than others with the same, but those lanugages might perform better in regards to their particular data type. It’s not just everything boiling down to one stream of code. At the machine level it is still a program.

JavaScript has until recently been considered the lame duck, but then V8 came along and opened the door for Node.js. This triggered the development community to improve JS so it was more C-like as spurred on by V8 and Node.js and we got ES2015, ES6, and ES+ as a result. Now it’s not such a lame duck. Angular.js and React.js piggybacked in on these improvements in the language. All because Node.js moved JS from the client to the host server.

Faster on a single machine is one thing, but faster over a network to all manner of clients is totally another. Not many languages can handle this payload. Thank the heavens that a lame duck would end up being the saviour. Not because of speed, but because of versatility and universality.


#3

Hmm, well, thanks for that…though I didn’t realize JavaScript was “slow” – it had always seemed fine to me, Google Maps and whatnot!

I still don’t understand how say C is supposed to be faster than C++, for example, or them two being faster than Python, or how Ruby is considered slow…yeah I figured that different languages will have different strengths and weaknesses which is exactly why I was curious how it could be said so definitively that one’s somehow fast, implying others are not as fast…

Those two statements could seem contradictory – unless I misunderstand what you mean by “machine level”…you’re talking about machine code, zeros and ones, right? In which case – at which level – there’s no longer any C or C++ or Python or Ruby or Java by then, right? So how’s one language faster than another (not talking about compilation times or such, of course) then??


#4

Even at machine level code still needs to be optimized. Some forms of compiled code are more efficient than ohters. Data streams of different sorts will eat up resources and clock ticks. It is the nature of the beast. If we are married to a particular data set, then optimizing our code for that data is our goal.

FYI… When I say ‘C’, I mean all its flavors.


#5

Well, okay, I’ll just take your word for it as I do some more research…there’s a great free course that I hope to undertake one day (soon [enough?]?) called “From Nand to Tetris” that utilizes a companion book (not free but it seems very interesting) where you learn everything building a (simulated) computer to programming its OS so as to develop a comprehensive understanding of what’s involved!! In-between there’s building the assembler, a high-level language and its compiler…maybe then all this will make sense to me!


#6

It is what it is. Book or no book, where are you going?


#7

Nowhere I can discern, frankly. I was hoping to learn enough for a junior front-end dev position but now it looks like I’m just gonna be a hobbyist 'cause all this is taking much too long to comprehend only halfway!!


#8

If you are my age, then hobbyist it is, but if you are a youngster then set your sights hgher.


#9

I’m smack in the middle of middle age but luckily don’t look it at all (my last girlfriend of seven years was seventeen years younger than me and a former small-time model, too)…so maybe I wouldn’t look too out of place in a coding interview – though the undated résumé could likely suggest otherwise!

Nah, my problem is comprehension. I’m hoping that it’s just a matter of exposure and practice…which is why I’m also reading up on everything from the classics SICP and How to Design Programs to The Elements of Computing Systems and A Common-Sense Guide to Algorithms and Data Structures…I hope by that by “hanging out with the right crowd,” as it were, I can be elevated intellectually…


#10

Maybe some booklearning will propel us both along but we still need to fit in.


#11

“Fit in”??

Interesting…I know about (and really do fear) the ageism in Tech but then I always figured that in a worst-case scenario, I could always teach kids in school or teach fellow old folks ('cause I’ll be truly old myself by the time I grok this computerese!!) at a senior-care home!

And if I get really good at programming then of course I can create my own app…


#12

Compiled Languages are ‘faster’ than interpreted languages because interpreted languages turn the code into machine code at runtime.

To abstract it some: it is the difference between talking to someone in their language and talking to them with a translator.

Interpreted languages have to do more behind the scenes as well. There’s going to be more table lookups per variable in a dynamic language.

Google and Facebook has an extreme amount of money and talent to optimize javascript to do what they need. It’s not always practical without those resources.

Languages are all about being a tool for the job.
Each Language was built with a vision or problem in mind. They will have different weaknesses and strengths.

As far as age, who cares. You are still sharp enough to learn. Pursue it for fun knowing that one day it could make you some money if you so desired.


#13

Oh yes, indeed – but even between compiled languages, even closely related ones, such as C and C++, it’s said that one (the former) is faster than another (the latter). That’s what I don’t get.

(And I also understand that there are languages like Java which are turned into “byte-code” which are then compiled into the machine code specific to the CPU…but I mean besides these obvious cases.)

Hmm, you’re right – I mean, I know Google came up with AJAX (IIRC) but I didn’t realize that that took an enormous amount of resources, really…

Well, that’s why I’m puzzled how even C can be faster than C++ (according to an old Dr. Dobbs’ article I’d read)…I’d imagine it all evens out overall (except in those specific use-cases which inspired the language’s genesis, of course)…

Well, I don’t care but I do know that ageism is so widespread in employment that the government had to make a law banning it (good luck trying to prove it, though) and you know what, a close second reason I would like a programming job is to be able to devote even more time to learning – learning while I earn! Otherwise, it’s this helter-skelter effort right now where I grab what time I can…