• ioen
    link
    fedilink
    198 months ago

    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.

    • @ZILtoid1991@lemmy.world
      link
      fedilink
      258 months ago

      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.

      • I Cast Fist
        link
        fedilink
        148 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

      • 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.

      • @AnAngryAlpaca@feddit.de
        link
        fedilink
        288 months ago
        • I have a limited amount of bandwith on my mobile plan
        • if i know a game download is large i go home where i have broadband; i dont download large files over mobile internet
        • a text-only website can be rather small with only a few KB. It’s only when you get ““Designers”” that things start to bloat, because the system fonts are not good enough and 2MB in extra fonts no sane visitor will ever notice must be downloaded.
        • the marketing department REALLY needs those 10 extra trackers and analytics scripts that take 5s to load, even if they last looked at the visitor stats back in 2021 and the login has long been forgotten.
        • the CEO wanted that animated AI powered talking gorilla widget he had seen on a local tradeshow where the customers can ask product or website questions (spoiler: they dont!), which ads a few more Megabytes to each pageload even before you even use it.
      • @Jesus_666@feddit.de
        link
        fedilink
        228 months ago

        Then again, those 100 MB are usually mostly assets I want to look at or listen to. Certain websites contain 100 kB of text and pictures I want to look at and load 2 MB of JavaScript frameworks that add nothing to the usability of the site. Bonus points for automatically streaming a 20 MB video I don’t want to watch while I look for one sentence’s worth of information.

      • @zalgotext@sh.itjust.works
        link
        fedilink
        78 months ago

        Imagine that, people don’t mind when they have to wait 10-15 minutes every once in a while for their game to update, but they do mind waiting 15-30 seconds every time they navigate to a new webpage.

    • @chellomere@lemmy.world
      link
      fedilink
      88 months ago

      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.

      • KaynA
        link
        58 months ago

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