this post was submitted on 18 Mar 2024
797 points (99.0% liked)

Technology

34984 readers
208 users here now

This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.


Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.


Rules:

1: All Lemmy rules apply

2: Do not post low effort posts

3: NEVER post naziped*gore stuff

4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.

5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)

6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist

7: crypto related posts, unless essential, are disallowed

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 8 months ago (3 children)

I always think it's unfair to compare things to video games. Video games are so inefficient they had to invent a separate processor with hundreds of cores just to run them. Of course they end up running well.

If cheap phones had a 128-core JavaScript Processing Unit, websites would probably run fast too.

[–] [email protected] 25 points 8 months ago (2 children)

Video game developer here. A lot of anti-optimiation sentiment are just excuses and/or part of some dumb trend.

Oh no, compiled languages require you to choose between variable types! Better use Javascript.

Why should we develop a proper portable app environment when we have Electron? It can even run in browsers. Imagine if you didn't had to go to your pops to install the word processor, instead he just types in wordprocessor dot app into the browser?

What if code was so easy to understand you didn't had to document it, and each macroblock of a function instead were a named function, so they'd be automatically documented?

And this is just the tip of the iceberg. I'm currently writing my own scripting VM, as most others have their own limitations, and would introduce a barely usable build system to my game engine (which are their own can of worms). Code as data is a very useful feature, but having to include DLL files as scripts would be very complicated due to platform differences, although also very fast. Issue comes when people treat scripting languages as full-fledged programming languages, and even scaring away beginners from compiled languages, because you have to compile them, you have to choose a type, etc.

[–] ICastFist 14 points 8 months ago

The real irony is that you can make games entirely with Javascript (no backend server needed) and I wouldn't be surprised if some of those games, even with 3D rendering via three.js or babylonjs, performed better than certain websites

[–] [email protected] 7 points 8 months ago

I just want to point out that interpreted languages don't have to be slow. For example, LuaJIT is competitive with Java in terms of performance, and not that much slower than C. Likewise, PyPy is almost always consistently faster than CPython, and Python 3.13 will have a JIT. I've also used numba to improve performance in Python (got close enough to naive Rust to not be worth adding Rust to our pipeline).

If you want scripting languages to be fast, there are options, so the decision should instead be made based on the benefits of each. For example:

  • scripting languages - generally better edit/reload experience, write once, run anywhere an interpreter exists
  • compiled languages - catch common errors before running, lots of fixes for various platforms

I'm super interested in Rust because it catches way more common errors than most compiled languages, so you're getting a lot more value for that compile step. My day job is Python + Javascript, though I have nearly 10 years with Go and most of my personal projects use Rust these days, so I feel like I'm fairly experienced here.

just excuses and/or part of some dumb trend

I agree. There are good reasons to prefer scripting languages to compiled languages and vice versa, but most people don't seem to decide based on those reasons, they often decide based on what's easier to hire for, what they're familiar with, or what's already being used.

I'm super excited about Rust gaining traction because it's basically the best case for a compiled language I've seen. Maybe it'll revise the trend toward higher level languages and encourage a bit more provable correctness.

[–] [email protected] 8 points 8 months ago (1 children)

separate processor with hundreds of cores

Well, graphics rendering is very suited for parallelism. That's why GPUs were invented.

Most other tasks are not. Most of the cores in a 128-core JPU would end up being unused. Also why JPU? It's not like it's significantly different from a normal CPU task.

[–] [email protected] 5 points 8 months ago

I don't think the person you replied to actually knows what they're talking about.