20 points

And I like rust programs for their memory safety

permalink
report
reply
0 points

Or even JavaScript as it takes away all the difficulty with complex applications

permalink
report
parent
reply
0 points

And I like Rust because compiling any rust package in my ~/.yay/cache takes longer than compiling the kernel (wait what)

permalink
report
parent
reply
64 points

Honestly, it’s still ridiculous to me how slow Python, Java, JS, Ruby etc. continue to feel, even after decades of hardware optimizations. You’d think their slowness would stop being relevant at some point, because processors and whatnot have become magnitudes faster, but you can still feel it quite well, when something was implemented in one of those.

permalink
report
reply
7 points
*

“Slow”

They aren’t as fast as a native language but they aren’t all that slow if you aren’t trying to use them for performance sensitive applications. Modern machines run all those very quickly as CPUs are crazy fast.

Also it seems weird to put Java/OpenJDK in the list as it is in its own category from my experience

permalink
report
parent
reply
3 points

Java is certainly the fastest of the bunch, but I still find it rather noticeable how long the startup of applications takes and how it always feels a bit laggy when used for graphical stuff.

Certainly possible to ignore that on a rational level, but that’s why I’m talking about how it feels.
I’m guessing, this has to do with just the basic UX principle of giving the user feedback. If I click a button, I want feedback that my click was accepted and when the triggered action completed. The sooner those happen, the more confident I feel about my input and the better everything feels.

permalink
report
parent
reply
3 points

I’ve never experienced that. Also Android is OpenJDK based and the applications in Android work well and the system is well optimized

permalink
report
parent
reply
15 points

That’s because it’s not relevant. Speed can be compensated for either by caching or outsourcing your load, if there’s such a huge need to process large amount of data quickly. In day to day work I can’t say I have ever ran into issues because code was executing slow. Normal operation Python is more than capable of keeping up.

On the other side of the coin you have memory management, buff and stack overflows and general issues almost exclusive to C, which is something you don’t have to worry about as much with higher level languages. Development with Python is simply faster and safer. We as developers have different tools, and we should use them for their appropriate purpose. You can drive nails with a rock as well, but you generally don’t see carpenters doing this all day.

permalink
report
parent
reply
0 points

Especially since languages such as Python and JavaScript are really good a event programing where you have an event that runs a function. Most of the CPU time is idling anyway.

permalink
report
parent
reply
10 points
*

You can sometimes deal with performance issues by caching, if you want to trade one hard problem for another (cache invalidation). There’s plenty of cases where that’s not a solution though. I recently had a 1ns time budget on a change. That kind of optimization is fun/impossible to do in Python and straightforward to accomplish Rust or C/C++ once you’ve set up your measurements.

permalink
report
parent
reply
0 points
*

Don’t throw the baby out with the bath water. There are many applications that don’t have performance needs such as a calculator app

permalink
report
parent
reply
0 points

Which is exactly what I said. Most of the times you can work around it. Sure cache invalidation can be hard, but doesn’t have to be. If you need performance use more performant language. Right tool for the job.

permalink
report
parent
reply
2 points
Deleted by creator
permalink
report
parent
reply
40 points

Many of these have C-bindings for their libraries, which means that slowness is caused by bad code (such as making a for loop with a C-call for each iteration instead of once for the whole loop).

I am no coder, but it is my experience that bad code can be slow regardless of language used.

permalink
report
parent
reply
7 points

At least with Java, its the over(ab)use of Reflections and stuff like dependency injection that slows things down to a crawl.

permalink
report
parent
reply
30 points
*

Bad code can certainly be part of it. The average skill level of those coding C/C++/Rust tends to be higher. And modern programs typically use hundreds of libraries, so even if your own code is immaculate, not all of your dependencies will be.

But there’s other reasons, too:

  • Python, Java etc. execute their compiler/interpreter while the program is running.
  • CLIs are magnitudes slower, because these languages require a runtime to be launched before executing the CLI logic.
  • GUIs and simulations stutter around, because these languages use garbage collection for memory management.
  • And then just death by a thousand paper cuts. For example, when iterating over text, you can’t tell it to just give you a view/pointer into the existing memory of the text. Instead, it copies each snippet of text you want to process into new memory.
    And when working with multiple threads in Java, it is considered best practice to always clone memory of basically anything you touch. Like, that’s good code and its performance will be mediocre. Also, you better don’t think about using multiple threads in Python+JS. For those two, even parallelism was an afterthought.

Well, and then all of the above feeds back into all the libraries not being performant. There’s no chance to use the languages for performance-critical stuff, so no one bothers optimizing the libraries.

permalink
report
parent
reply
19 points

Java is still significantly faster and more efficient than Python tho - because it has ahead-of-time optimizations and is not executing plain text.

permalink
report
parent
reply
11 points

For example, when iterating over text, you can’t tell it to just give you a view/pointer into the existing memory of the text. Instead, it copies each snippet of text you want to process into new memory.

As someone used to embedded programming, this sounds horrific.

permalink
report
parent
reply
12 points

True, plus the bloated websites I see are using hundreds of thousands of lines of JavaScript. Why would you possibly need that much code? My full fledged web games use under 10,000.

permalink
report
parent
reply
1 point
*

But but but virtual DOM /s

permalink
report
parent
reply
7 points

It is always a question of chosing the right tool for the right task. My core code is in C (but probably better structured than most C++ programs), and it needs to be this way. But I also do a lot of stuff in PERL. When I have to generate a source code or smart-edit a file, it is faster and easier to do this in PERL, especially if the execution time is so short that one would not notice a difference anyway.

Or the code that generates files for the production: Yes, a single run may take a minute (in the background), but it produces the files necessary for the production of goods of over 100k worth. And the run is still faster than the surrounding processes like getting the request from production, calculating the necessary parameters, then wrapping all the necessary files with the results of the run into a reply to the production department.

permalink
report
parent
reply
24 points

There are a few reasons for this, some of the most important being:

  • The languages were not designed with speed primarily in mind and as such made some design decisions that fundamentally cannot be optimized around
  • Authors of programs in these languages prioritize things other than performance when writing the programs.

Speed is not just about processors becoming faster - this is a large part of why DSA is important to learn as a programmer.

permalink
report
parent
reply
1 point
*

They do have optimizations however they are interpreted at runtime so they can only be so fast

Frankly you won’t notice much unless the program is doing something computation heavy which shouldn’t be done in languages such as JavaScript and Python

permalink
report
parent
reply
2 points

This is because they are meant to be simpler for complex logic. They don’t want to be faster by ditching the simplicity

permalink
report
parent
reply
1 point

Java isn’t slow

permalink
report
parent
reply
17 points

https://github.com/hykilpikonna/hyfetch

I like hyfetch because it has the largest os compatibility.

It feels like the spiritual successor to neofetch tbh.

permalink
report
reply
4 points

yeah and it allows for queering up the distro logo, which I absolutely love.

permalink
report
parent
reply
2 points

It’s still slow and written in Bash/Python

permalink
report
parent
reply
0 points

And because it has funny colors. Other than that, it’s very slow.

permalink
report
parent
reply
21 points

I used c++ in college, and I think it’s useful to know c because so much relies on it. That said if I’m going to do something that needs performance I’ll look to go first, then rust if go isn’t a good fit, but that’s mostly because I know go better. Both are excellent languages.

If I just need something functional quick and easily I’ll turn to Python. If I need a net service quick node.js is great.

permalink
report
reply
5 points

I was a huge C++ fan back when I was doing a bunch of competitive programming. If I need a performant project nowadays, I look to golang first. It gives me the speed of a compiled language with the usability of high-level language. I still solve the occasional Advent of Code in C++, though :)

permalink
report
parent
reply
29 points

As someone who only codes solutions for himself I don’t relate. All the extra time I would spend writting a C solution it would never attone the runtime loses of doing it in maybe python.

permalink
report
reply
10 points

I used to write extensively with C++, but it has been a long time since speed mattered that much to one of my applications. I still marvel at the cache-level optimizations some people come up with, but I’m in the same mindset as you now.

My workload split of Data Movement vs Data Transformation is like 95:5 these days, which means almost all the optimizations I do are changing batch/cache/page/filter settings. I can do that in any language with http bindings, so I choose those that are faster to write.

permalink
report
parent
reply

Anyway, this is only relevant if you’re writing only for yourself. It’s your poor users who suffer for your expediency.

permalink
report
parent
reply
1 point

Shaves off 1 sec and I do it 50+ times a day, checks out.

permalink
report
parent
reply

linuxmemes

!linuxmemes@lemmy.world

Create post

Hint: :q!


Sister communities:

Community rules (click to expand)

1. Follow the site-wide rules
2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of “peasantry” to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
4. No recent reposts
  • Everybody uses Arch btw, can’t quit Vim, and wants to interject for a moment. You can stop now.

 

Please report posts and comments that break these rules!


Important: never execute code or follow advice that you don’t understand or can’t verify, especially here. The word of the day is credibility. This is a meme community – even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don’t fork-bomb your computer.

Community stats

  • 6.6K

    Monthly active users

  • 1.1K

    Posts

  • 24K

    Comments