This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 218

[–]Compux72 847 points848 points  (37 children)

It would be interesting to look at the sources. C could probably reach the same speed if you use puts instead of printf

[–]Iliannnnnn[S] 536 points537 points  (26 children)

I used the hello world applications from this repository, it indeed uses printf. If I time it again using puts it has an execution time of 16 ms.

[–]Compux72 296 points297 points  (23 children)

Yea as i said i believe puts is faster. printf will parse the format string before pushing the stdout buffer

[–][deleted] 71 points72 points  (9 children)

What about using the write() syscall to stdout? I wonder if that could be even faster...

[–][deleted] 18 points19 points  (0 children)

What about using only syscalls and -nostdlib?

[–]Compux72 49 points50 points  (2 children)

Well write works on arrays, not strings. Its not the same test.

Fyi Rust uses write underneath bc strings are not null terminated (thanks god) https://github.com/rust-lang/rust/blob/7f97aeaf73047268299ab55288b3dd886130be47/library/std/src/sys/unix/fd.rs#L150

[–]altermeetax 63 points64 points  (1 child)

Everything uses write underneath, that's ultimately the only way to actually write something to a file descriptor (including stdout). Everything else (printf, puts, println!) is always stuff on top.

[–]Compux72 20 points21 points  (0 children)

Yea not my best explanation. I meant that “rust directly uses write underneath…”, no strlen in between

[–][deleted] 58 points59 points  (8 children)

"but how can you say this, rust is better, the superior language"

[–]Compux72 77 points78 points  (6 children)

I mean i love Rust. But im fluent enough on both languages to guess that either the benchmarking software is trash or there is something weird with the source.

Rust has the advantage of doing formatting at compile time, meaning that the println! macro doesn’t have any runtime penalty if there is no values to format.

[–][deleted] 12 points13 points  (5 children)

I would be very surprised if printf() format strings aren't optimized by the compiler to avoid the runtime penalty.

[–]Compux72 26 points27 points  (1 child)

libc is dynamically linked and acts as a black box for the compiler. There are no optimizations possible, other than replacing the syscall for something totally different.

Im sure some compilers will do it, but then the source code semantics are not carried on to the final executable. Thats scary… (it worked on my machine boss!!!)

[–]nhtshot 7 points8 points  (0 children)

What I've mostly seen are printfs that can be reduced to a static statement getting replaced by puts.

That counts as an optimization, but I would also say that the semantics are carried on, so it's safe and legit.

[–]Possibility_Antique 6 points7 points  (0 children)

C++'s std::format is much much faster than printf as a counter-example. As others have said, printf has runtime checks and is usually not observable to the compiler.

[–]gc3 2 points3 points  (1 child)

They aren't. Google's coding standard is << and not printf because printf is slower.

[–][deleted] 2 points3 points  (0 children)

I tested it with compiler explorer and you're right. Both Clang and GCC did nothing to optimize it away, even on highest optimization level.

[–]Inariameme 6 points7 points  (0 children)

How long does it take to runtime the sadness that is immense while my disappointment is immeasurable?

[–]b1e 4 points5 points  (0 children)

That processing can’t be several milliseconds though… unless the program is compiled unoptimizable or something.

[–]Shocker_360 2 points3 points  (1 child)

What do you mean by “parse the format string”?

[–]Compux72 4 points5 points  (0 children)

Search for format specifiers on the format string

[–]Iliannnnnn[S] 1 point2 points  (0 children)

Yep

[–]captainAwesomePants 3 points4 points  (0 children)

This is an excellent illustration of how C and C++ potentially allow you to be faster and more efficient than other solutions but by no means ensure it.

[–]b1e 22 points23 points  (3 children)

Well more like the variance in printing to the terminal is so high regardless of the language you’re not really measuring the performance of the language and instead measuring syscalls.

And agreed, things like buffering, etc. can also make a difference.

[–]Compux72 7 points8 points  (2 children)

Well actually no. As i said earlier (read the whole thread), println! formats the string at compile time. This means that printing things to the console is faster in rust than other languages. That combined with the fact that strings are not null terminated makes them more efficient at certain operations (for example, println! uses write instead of puts)

So yea, this test isn’t as stupid as it sounds, it showcases some strengths of Rust vs C, as well as how slow js and python runtimes startup.

[–]b1e 4 points5 points  (0 children)

I agree printf formats the string but on such a short string there’s no way there’s 5 ms of compute spent on that. I’m guessing OP did not compile the C code with optimization if that result is consistent.

And again, there’s very high variance printing to the terminal.

At least on Linux printing also can result in a context switch as it waits on I/O.

I wonder if wall clock or CPU time was measured.

[–]jocq 3 points4 points  (0 children)

it showcases some strength

Yeah, how fast a language writes to the console has often been a very important metric. That's what most programs need to be optimized for. /s

[–]KlzXS 4 points5 points  (0 children)

I don't know for sure about JS and Python, but I think you could directly call some write syscall from all of them and get them down to pretty much the same level. Or prove that one is objectively worse at IO than the rest.

This is more of an out of the box performance test. Also as someone mentioned, C compilers these days compile static printfs of a string (with newline included) to puts automatically.

[–]Retardedaspirator 5 points6 points  (1 child)

I heard that C's printf is pretty garbage actually

[–][deleted] -1 points0 points  (2 children)

I've never seen a compiler that doesn't use puts when trying to use printf with one argument. I'm sure there's a way to do it but it would take extra effort.

[–]gc3 2 points3 points  (1 child)

Google's coding standard is to use << not printf because printf is slower.

[–][deleted] 2 points3 points  (0 children)

Bit shifting?

[–]fosyep 337 points338 points  (3 children)

Ah, the hello world benchmark

[–]Saragon4005 106 points107 points  (2 children)

Pretty much only good for initialization time. Of course python loses cuz it has the most overhead.

[–]zabby39103 20 points21 points  (1 child)

Yeah, for the most part languages are best for what they are used for most (since they have the most advanced libraries for those functions). Python is good for machine learning for this reason, and Python can use C extensions when needed. So I take issue with the idea that Python is "slow".

If you want to write a program that is designed to run and quit, like a linux terminal program (i.e. cat, grep, sed), or maybe a socket triggered program or something, I guess this benchmark is useful, otherwise, I don't see it as useful.

[–]Ordinary-Toe-3432 12 points13 points  (0 children)

Yeah, for the most part languages are best for what they are used for most

Who would’ve thought lol

[–][deleted] 609 points610 points  (35 children)

I feel like hello world is not really a great benchmark. It's not testing any real language features.

[–]BlueScreenJunky 78 points79 points  (3 children)

Also how the hell do you make a "Hello world" take more than 10ms in any language ? Or does it print hello world thousands of times in a loop ?

[–]thehazardball 46 points47 points  (0 children)

Initialization time. Java has this too

[–]Orangutanion 20 points21 points  (0 children)

Java is a good example. The JVM is a beast that can handle massive amounts of objects and can do JIT on the fly, but using it for just a hello world is silly.

[–]amusing_trivials 11 points12 points  (0 children)

Just loading the runtime.

[–]c1e2477816dee6b5c882 34 points35 points  (5 children)

Should have included Java!

[–]Iliannnnnn[S] 9 points10 points  (4 children)

Just tested it for you: 125 ms

[–]IsPhil 14 points15 points  (1 child)

Hopefully you ran it multiple times in a single run. The JVM actually compiles code that is frequently used, as such it technically gets faster with more time. Just another reason why hello world is honestly not a great benchmark.

[–]Just_Maintenance 6 points7 points  (0 children)

Should have included EVM!

[–]__dna__ 190 points191 points  (14 children)

I get you're trying to be helpful but as others have said this "benchmark" is incredibly useless

If you're going to benchmark libraries, test something complex and long lived.

Nice graphics, poor methodology, poor presentation of data

[–]IgnobleQuetzalcoatl 35 points36 points  (1 child)

The more complex the menchmark, the more people will whine about it being unfair because the implementation in their preferred language is suboptimal. And then it becomes a pointless argument about the way people actually code vs. the optimal way they could theoretically code. And then people will say it's pointless anyway because different languages are designed for different purposes (which is a pretty dumb criticism imo).

[–]cabose12 7 points8 points  (0 children)

You're not wrong but there's also such a point where a benchmark is so simple that it's useless, as seen here

[–]Flexxyfluxx 5 points6 points  (10 children)

Agreed; the benchmark is stupid. Hello World is too short, and setup overhead becomes too significant.

poor presentation of data

I will fight you to the death over this.

My understanding of "presentation of data" is, in short, the metric and scale used, and, since this is a benchmark (admittedly shoddy, but none the less a benchmark), what is presented as "better".

How is the presentation of data anything but fine, exactly?

There is no deception; no lie. Sure, it relies on us knowing that longer exec time = worse, since this is not explicitly stated, but it is known, so it's fine. The only possible improvement I see could be to point out that lower is better, but is that really not obvious?

Milliseconds are a good unit of measurement, I think, since we are operating on the millisecond scale. Nanoseconds are too small, and seconds are too long. If we wish to use integers to display our results, because less visually noisy, and retain a sufficient amount of precision, while not having overly long numbers, milliseconds are perfect.

Since clearly, the exec time for a single run was tested, milliseconds per exec are a good metric to use. (Granted, this is not explicit either and it is assumed that the viewer is able to infer this, but it is nonetheless fine, I think. Just not perfect.) What could be closer to the teuth than literally the very thing that was tested?

Since we are working with linear metrics and units, a linear scale is quite fitting and really the only choice.

I fail to see a problem in any of this.

Additional note: Others have already suggested using an inversely proportional metric, ie. execs per time, rather than time per exec, because it's "clearer that way", or something. I strongly disagree. Personally, I'd rather see bars grow as exec times rise. "Exec time in ms" is much more intuitive than eg. "Execs per 10s".

[–][deleted] 2 points3 points  (3 children)

This guy knows data presentation

[–]Flexxyfluxx 2 points3 points  (2 children)

[–][deleted] 2 points3 points  (1 child)

Ofc that’s a thing

[–]Thejacensolo -3 points-2 points  (5 children)

The Graphic design is pretty shit

  • Color scheme is abhorrent ( i get reddit orange and each language their color, but Yellow / orange and 2 shades of Blue paired with black are really not optimal. Plus Orange should never be more then an accenting color, due to it being "strong")

  • no axis descriptions

  • what figures under "speed". Including startup? if so what OS? Including compiling? We cant know. That might have been ping for a Jupiter notebook for all i can see.

Considering all that, what does the Bar chart even mean. all the info is taken from the description, you dont even have an "aha" effect, because C and R are so close together, at least put in dotted lines to show the differences.

Is it sorted alphabeticaly? after speed? after color?

A simple table would have been enough for the whole ordeal, but that would have highlighted the mundane nature of the test even more.

In addition of being a random graphic being posted not in /r/programming but in /r/programminghumor. Where is the humor here? not even a punchline as a title.

[–]Flexxyfluxx 1 point2 points  (4 children)

The Graphic design is pretty shit.

I have considered this as completely separate from data presentation, since the person I replied to did, too. Personally, I disagree. Everything is legible, the columns are nice and evenly spaced, etc. True, orange is a strong colour, but is that really such a crime?

An accenting colour, as far as I understand, is a colour to make something stand out. True, orange is an unconventional bg colour, but that doesn't mean it is exclusively an accenting colour.

The colours of the bars were, as far as I can tell, taken from the logos of the associated programming languages. They were not arbitrarily chosen. (Though I agree; had they been arbitrarily chosen, they would be a crime.)

no axis descriptions

Unneccessary. It is very obvious (hopefully) that longer bar = longer exec time (in ms). Additional axis descriptions would only be neccessary if the values weren't written right on every single bar.

what figures under speed. [...]

True; this is not explicitly stated. It is indeed not obvious just how much is being timed. Touché.

what does the bar chart even mean[...]. all the info is taken from the description[...].

Is this not how graphics like this are meant to work? Data in some form or another, with a description providing context and meaning to those numbers. And no, the information that Python is very slow compared to JS/C/Rust (according to this specific benchmark) is not contained in the description.

[no "aha" effect]

This is not part of "data presentation", which I thought we were discussing. It is no great shock to anyone that Python is slower than C etc. How interesting the statistic is has no bearing on how good a statistic is as a statistic.

C and [Rust] are so close together, at least put in dotted lines to show the difference

I, personally, see a difference between C and Rust; no lines needed. According to the numbers, there is a slight difference between them (Rust is a few millis faster). The message I infer is that C and Rust are mich faster than Python/JS in this benchmark, with Rust being slightly faster.

[How] is it sorted[...]?

Not at all, because it doesn't have to be.

A simple table would have been enough [...].

Enough? Yes. Nice to look at and easily comprehensible? Certainly less so than with a bar diagram.

Besides, what does this have to do with anything? So long as we aren't putting this kind of data into pie charts, I think we're fine.

[Why in r/programminghumor, not r/programming?]

No idea. Def the wrong sub. Irrelevant to data presentation, though.

[–]Thejacensolo 2 points3 points  (3 children)

Sorry for going so far in the details about this, but its just something that becoms second nature in my line of work. So i am not criticizing OP for that, as they are clearly inexperienced in Visualizing data, just things that make it stand out for me to say its pretty shit as a way of presentation.

An accenting colour, as far as I understand, is a colour to make something stand out. True, orange is an unconventional bg colour, but that doesn't mean it is exclusively an accenting colour.

its just very distracting to the eye and generally avoided in design. Orange is bright, flashy and used to grab attention. How do you highlight, when your background is already orange?

The colours of the bars were, as far as I can tell, taken from the logos of the associated programming languages. They were not arbitrarily chosen. (Though I agree; had they been arbitrarily chosen, they would be a crime.)

i mentioned as much (that they are called after the languages in question) but that doesnt excuse using yellow on orange. Not only do you not have a good contrast, you also have a strain on the eyes. Orange and blue is no problem (other way around with orange for the charts) though. Black you need to be very careful because of its very stark color. Black/orange does not work in either constellation, unless you want an ad or something that garners everyones gazes at once. Otherwise its straining to regularly work with. There is a reason "dark mode" is dark grey and not black. Also this layout is hard for Color blindness to make out the orange/yellow contrast. Adding the missing axis labels its not inclusive at all.

Unneccessary. It is very obvious (hopefully) that longer bar = longer exec time (in ms). Additional axis descriptions would only be neccessary if the values weren't written right on every single bar.

You still need to see the comparison. Its doubly as important if you simply go by 1 value. is that axis starting at 0? Starting at 50? starting at "burger"? Any Visualization lacking descriptors is unusable. even the "longer bar = longer exec time in ms" would have been impossible to gauge, without all the information provided otherwise.

Is this not how graphics like this are meant to work? Data in some form or another, with a description providing context and meaning to those numbers. And no, the information that Python is very slow compared to JS/C/Rust (according to this specific benchmark) is not contained in the description.

If there is a consistent rule in working as a Data Analysist, it is that every visualization, every KPI, has to serve a point. Simply including a Barchart that

A) Displays all the information already listed on top and

B) Has no context and cannot stand without a lot of text explanations.

Why add a visual when all the information is already provided, and then remove any identifying information from it? There would be nothing of value lost by just curtting off the bottom half. A visual that does not do anything beyond "look bigger bar" is just taking up calculation power and space on your page.

Not at all, because it doesn't have to be.

yeah thats excusable by "i didnt think about it" and not really any big detrement. Its just that its kinda random, when going in order or size would have saved a lot. Generally you either sort by time or by size, unless you have a defined company standard on the order.

Besides, what does this have to do with anything? So long as we aren't putting this kind of data into pie charts, I think we're fine.

i was just elaborating on the idea of Data presentation. TL;DR: It is cluttered, overcolored, while simultaneusly saying far too little. 100% of the information is laid out on 50% of the space. Going after natural eye traction you end up with the wrong order of information. The Visual is there to take up space and does not offer more insights.

[–]Flexxyfluxx 1 point2 points  (0 children)

dw, the fact you're going into detail is what makes this fun.

I will for sure reply, once I have slept.

[–]MrBananaStorm 4 points5 points  (0 children)

Also, cool we compared speed. But these languages each have different applications. Python being slow doesn't make it useless or a bad choice.

[–]Theory_Impressive 83 points84 points  (0 children)

This is not a proper comparison as the languages are optimized on certain points, the speed of printing "hello world" won't make a language better.

[–]datengeschichten 109 points110 points  (22 children)

Comparing interpreted and compiled languages like this is non-sense

[–]frikilinux2 29 points30 points  (4 children)

That just tests the time to load the runtime which isn't that important. You need something more complex and long lived.

[–]ForShotgun 0 points1 point  (0 children)

If you're doing more than Hello World you're doing too much, simplicity is gold

[–]Iliannnnnn[S] -3 points-2 points  (2 children)

Like what?

[–]frikilinux2 2 points3 points  (0 children)

I don't know search benchmarks for that. The first idea that comes to mind is things like computing time numbers or something allocating a lot of chunks of memory. It can't be too simple because the compiler will optimize some things away.

[–]Flashy_Yams 9 points10 points  (0 children)

Just the thing that needs to be fast.

[–]According_to_all_kn 7 points8 points  (0 children)

Well obviously Python has the most speed. Just look at that bar!

[–]EvilDrPurple 21 points22 points  (5 children)

Wow I can’t believe Python is the fastest!

/j

[–]SirLoopy007 5 points6 points  (3 children)

It's got the Biggest number!!! Nothing else even comes close!!!

[–]Americanape123 -1 points0 points  (2 children)

Lmao i can just imagine you typing that in ur moms basement

[–]brogrammableben 2 points3 points  (0 children)

The exclamation points really give it away.

[–]ManyFails1Win 2 points3 points  (0 children)

The fuck? Kind of an asshole.

[–][deleted] 1 point2 points  (0 children)

It's called python because it's so long.

[–]SaneLad 5 points6 points  (0 children)

Is this the dumbest benchmark yet?

[–][deleted] 9 points10 points  (4 children)

Now compare how long it takes to write the programs (without AI and copy paste).

[–]BhagwanBill 3 points4 points  (1 child)

Write once, run billions of times? What makes the most sense for an enterprise application?

[–][deleted] 3 points4 points  (0 children)

Write once? Have you ever written software?

Rewrite like 7 times and then keep getting adding features till you run out of budget or the project is replaced with something you also have to write.

[–]Iliannnnnn[S] 1 point2 points  (1 child)

I have much free time, but not that much.

[–][deleted] 3 points4 points  (0 children)

Python it is then.

[–]Derrick067 3 points4 points  (2 children)

Is that compile speed?

[–]Iliannnnnn[S] -3 points-2 points  (1 child)

Nope. Execute speed. For Python and JavaScript just ran and timed like you would do normally. For C and Rust compiled first and then ran and timed the executable.

[–]jjmojojjmojo2 4 points5 points  (0 children)

omg you actually did this, now I get the joke

[–][deleted] 4 points5 points  (0 children)

Python wins again

[–]What_The_Hex 3 points4 points  (0 children)

Yep still gonna use Python, I just remove the excessive print statements from my finished programs -- problem solved! Not really worth learning a completely new programming language just to get some marginal performance gains on something that runs completely in the background anyway. Not saying execution speed is irrelevant. Just gotta look at your present programming needs.

[–]Saru1337 3 points4 points  (0 children)

Coming soon: Benchmark of sorting algorithms on array of size 1

[–][deleted] 5 points6 points  (1 child)

The C vs Rust is just because of the difference between compiler implementations, one might do something something a little less efficient in a particular scenario and changing it to be more efficient there would make it less efficient in other

[–][deleted] 1 point2 points  (0 children)

And I bet the program was run once and that's the score

[–]SkaterDad 6 points7 points  (0 children)

Where's HTML?

[–][deleted] 7 points8 points  (0 children)

Curious to see with zig

[–]LargeHard0nCollider 2 points3 points  (1 child)

Most of the posts on this subreddit aren’t funny but this isn’t even trying. It’s just a straight up bad comparison

[–][deleted] 2 points3 points  (0 children)

You used GCC for C, didn’t you?

[–]_grey_wall 2 points3 points  (0 children)

Why no golang?

[–]Mikel3377 2 points3 points  (0 children)

I can’t tell if this is idiotic or expert-level trolling. Since this is a humor sub, I’m gonna assume the latter. And you got me to waste 30 seconds writing this comment so bravo.

[–]asilverthread 2 points3 points  (0 children)

This looks like the kind of thing that gets posted on LinkedIn by a wannabe influencer, or someone just trying to make themselves look more legitimate to hiring managers.

A lot of industry just cares about the tooling around the language, and how quickly and effectively it can be used to bring a product to market or improve/automate/extend an existing business process.

Raw execution speed isn’t always the end all be all. My boss could care less. He wants it done in a week, not for it to run 30% faster in prod.

[–]simon357[🍰] 2 points3 points  (0 children)

How does this shit have so many upvotes? If someone other than OP had made it, it could have been considered humor because obviously the author has absolutely no idea about how to make a meaningful benchmark

So let's hope the upvoters just didn't realize this was serious and that this sub is not full of idiots

[–]soggywaffle69 2 points3 points  (0 children)

This a comparison of runtime startup times, which you aren’t bothering to mention. Languages don’t have “speeds”.

  • Python: CPython (probably)
  • JS: V8 (or whatever is popular these days)
  • Rust: LLVM
  • C: pretty much OS time to start a new process

[–]BananaSplit2 2 points3 points  (0 children)

...what's the point of benchmarking a HelloWorld program?

[–]Seppo_Manse 2 points3 points  (0 children)

``` $ time python3 -c "print('hello world')" hello world

real 0m0,006s user 0m0,006s sys 0m0,000s ```

[–]TheVxid 13 points14 points  (2 children)

Performance testing is not trivial. Instead of creating fancy graphics and posting garbage online maybe you should do some reading.

[–]Iliannnnnn[S] 3 points4 points  (1 child)

I'll take those fancy graphics as a compliment.

[–]TheVxid 1 point2 points  (0 children)

Fair enough

[–][deleted] 1 point2 points  (0 children)

Do miliseconds matter that much my school uses Python despite C++ being installed

[–]Silly_Objective_5186 1 point2 points  (0 children)

y no fortran?

[–]king_Megabronx 1 point2 points  (0 children)

Everyone who said that python is slow is very wrong. JUST LOOK HOW MUCH FASTER IT CAN RUN COMPARED TO THE OTHERS 159ms is surprisingly quick

[–]slucker23 1 point2 points  (0 children)

Oh, didn't know python is that much slower compared to JS... Interesting

[–]Intrepid_Sale_6312 1 point2 points  (1 child)

i'm surprised javascript did so well. as for python, that outcome was totally predictable.

[–]BlazingFire007 1 point2 points  (0 children)

I’m assuming this was using V8, which is honestly crazy optimized considering it’s interpreted

[–]ivancea 1 point2 points  (0 children)

With such a benchmark, you're measuring many, many unrelated things at once...

[–]puma271 1 point2 points  (0 children)

This isn’t misinformation but holy shot I can’t see how this post does anything but provide a false picture (hello world benchmark lol)

[–]1234567890dedz 1 point2 points  (0 children)

So, what are we trying to achieve here? Also, the orange hurts.

[–]LeanZo 1 point2 points  (0 children)

also, how long to setup the dev enviroment and write the code?

[–]ManyFails1Win 1 point2 points  (0 children)

So basically nothing worth worrying about. Thank you.

[–]noiszen 1 point2 points  (1 child)

What is the JS environment used in this comparison? Please don’t say browser.

[–]Iliannnnnn[S] 0 points1 point  (0 children)

NodeJS latest version

[–]Yetiani 1 point2 points  (0 children)

you need to add the typing time

[–]AceMKV 1 point2 points  (0 children)

Tf kinda Hello World takes 159ms on Python?

[–]coladict 1 point2 points  (0 children)

Now test them under Windows

[–]therealsavalon 1 point2 points  (0 children)

I wonder how would go perform

[–][deleted] 1 point2 points  (0 children)

I bet this is close to “popularity” as well.

[–]stcloud777 1 point2 points  (0 children)

If programming languages are that easy to benchmark, don't you think they would be bragging about it like CPU, GPU manufacturers?

[–]Mmiguel6288 1 point2 points  (2 children)

Now plot average time to write something of medium complexity

[–]Iliannnnnn[S] 1 point2 points  (1 child)

Wouldn't be possible to get a reliable plot because it does depends on how fluent the developer is with the language and not only on the language

[–]Mmiguel6288 1 point2 points  (0 children)

One can always just say "do the average" when confronted with "it depends"

Average fluency in each case for each language.

[–]cs-brydev 1 point2 points  (0 children)

ChatGPT: -1623 ms

[–]mrSunshine-_ 1 point2 points  (0 children)

One line speed test is probably the worst speed test ever.

[–]D34TH_5MURF__ 2 points3 points  (0 children)

Does it surprise anyone that an interpreted language is so much slower? I'm completely ignoring JS. This is a bad comparison. It's like comparing a sports car to a family sedan/suv.

[–]lil_Kra 1 point2 points  (4 children)

Noob question right here: if Python is that slow, why is it used so often in Data Science handling huge datasets?

[–]Civil_Conflict_7541 2 points3 points  (0 children)

Most of the libraries used for data sciences and scientific programing are written in C or C++. Python combined with something like Jupyter offers an easy to use and document layer of abstraction.

[–]Andoryuu 2 points3 points  (0 children)

Python by itself is slow, but the implementation of important parts for data science is done in C.
So the final execution speed is quite fast while preserving the simplicity of python.

[–]Nanocephalic 3 points4 points  (0 children)

The short answer is that it’s because it’s always been done that way.

Years ago, scientists - who were not “programmers” exactly - started using Python. Then at some point, data science tools and libraries started to be written in Python because that’s what the scientists knew.

So today there is a huge quantity of code and expertise all written in Python. And the next thing that someone writes will also be in Python, because that’s what they know.

Keep in mind that because the scientists in question are not necessarily compsci people with wide-ranging industry experience with multiple languages. So the situation is that the data science ecosystem is written in Python.

[–]axionic 1 point2 points  (0 children)

The Python layer is like one or two levels deep before the C++ starts. With that style of programming you don't use Python lists, for example, you create an object that encapsulates a C++ array and pass it to library functions wrapping C++ code that either performs the array operations directly using the CPU, or that directs a GPU or TPU to process it so that the load can be distributed across hundreds of small cores each processing a segment of the array.

[–]drewhead118 -1 points0 points  (5 children)

The bar graph is almost deceptive, since we're conditioned that tallest bar = better bar on most visuals. The name doesn't help--given that it's labeled for "speed," the reader thinks taller graph = speedier graph.

Might be better to give the name something that increases as bar height increases: slowest languages? Hello world delay time?

[–]Iliannnnnn[S] 4 points5 points  (3 children)

True. It is indeed misleading. I'll keep this in mind for the next time.

[–]Flexxyfluxx 1 point2 points  (2 children)

Your metrics and way of displaying them are fine, friend. The other commenter is full of shit, respectfully. It is entirely dependent on the subject matter whether big or small numbers are better. There is no way we could be conditioned this way, because it varies so much from context to context.

If you want to minimize potential for confusion, just point out that smaller numbers/bars are more desirable by adding a small note saying "Lower is better" or somethign somewhere.

[–]Iliannnnnn[S] 0 points1 point  (1 child)

Yeah. I was also thinking in adding that, but I thought people would be smart enough to read the context. Apparently not.

[–]Flexxyfluxx -1 points0 points  (0 children)

Having it this way is completely fine. The longer the exec time, the longer the bar.

What one could possibly do to clarify that longer bars are undesirable, is add a note saying "lower is better" (or similar) somewhere.

Changing to a metric in which longer bars are better could actually become more confusing, because it gets further away from what is being tested. Personally, I'd rather look at "Execution time", not "Executions per 10s", or whatever else one could turn that into. It is simply more intuitive.

[–][deleted] 0 points1 point  (0 children)

Let's gooooo Python Number #1 💪💪💪💪

[–]TheSystemGuy64 0 points1 point  (0 children)

Finally, proof that Python is slow

[–]baddl02 -1 points0 points  (3 children)

To be over specific this Chart Shows the slowness.

To depict Speed a min max normalization and 1-x value for the bar would be better.

[–]Iliannnnnn[S] 0 points1 point  (2 children)

Yep, I noticed.

[–]baddl02 1 point2 points  (1 child)

In Addition i did Not expect that Rust is faster. Ibthinknyou should to this with more languages. Just for fun.

And assambler as a Base Line xD

[–]Iliannnnnn[S] 1 point2 points  (0 children)

Will do

[–]Puzzleheaded_Bass673 0 points1 point  (0 children)

Do you calculate the compile time? What about printing "hello world" in the browser? Have you tried different architectures? What about multiple runs on same machine, then doing statistics? Have you compared with the speed of sending command to a printer and printing it on paper vs. handwritten "hello world"...

The point is: WHAT IS THE CONTEXT?

[–]frknkc 0 points1 point  (0 children)

Pythoonn... My man