[-] FizzyOrange@programming.dev 10 points 3 weeks ago* (last edited 3 weeks ago)

Ah this ancient nonsense. Typescript and JavaScript get different results!

It's all based on

https://en.wikipedia.org/wiki/The_Computer_Language_Benchmarks_Game

Microbenchmarks which are heavily gamed. Though in fairness the overall results are fairly reasonable.

Still I don't think this "energy efficiency" result is worth talking about. Faster languages are more energy efficient. Who new?

Edit: this also has some hilarious visualisation WTFs - using dendograms for performance figures (figures 4-6)! Why on earth do figures 7-12 include line graphs?

[-] FizzyOrange@programming.dev 10 points 1 month ago

What would they sign it with? How do you verify the signature?

[-] FizzyOrange@programming.dev 10 points 1 month ago

As far as I can tell it's mostly the TPM requirement and pushing more ads / AI nonsense.

You can easily avoid the latter by using the LTSC IoT version. I just bought a new (second hand) computer for TPM (my old one was very due for an upgrade).

With the IoT version it's absolutely fine. Definitely an improvement over Windows 10. The only issue I've noticed is it doesn't come with Windows Game bar or some nonsense so after you run games you'll get a random dialog about there not being an app available to handle ms-gamelink URLs or something. You can just ignore it. I might fix it one day.

[-] FizzyOrange@programming.dev 10 points 2 months ago

The linked patch actually explains it really well.

If you want two processes to communicate (IPC) normally, you would set up some shared memory, so that in each process's virtual memory some pages are shared between them both, so when process A writes to that memory it is visible to process B and vice versa. There are other ways to do IPC but this is the fastest since it doesn't involve any syscalls (context switch to the kernel which is slow).

However it still requires each process to copy its private data into and out of the shared memory. Also it still requires a context switch from process A to process B.

A common use of IPC is for RPC (Remote Procedure Calls). Basically you want to run a function in the other process. This solution does that but differently and faster.

  1. First, both processes share the same virtual memory. This is normally a recipe for disaster since it completely destroys the normal process memory sandboxing (a memory error in one process can now crash the other one!). However they use a new Intel MPK hardware feature that allows splitting the pages into one of 16 groups ("keys"), and you can control read/write access to each group independently.

  2. Next when process A wants to call a function in process B, the RPAL code does a lightweight context switch in user space. I guess this just means changing the MPK key, and normal saving of registers for the function call. I'm not sure what else you'd need to change. It's a little unclear about how you pass heap data from process A to process B. I guess both processes just have read access to the entire address space? That doesn't really change the security model on Unix since any process can already debug any other process with no extra permissions.

It sounds very similar to running two processes as if they were threads in the same process. Why not just use threads? Probably a better option if you can, but I guess if you are e.g. running processes written in different languages that might be tricky?

[-] FizzyOrange@programming.dev 10 points 3 months ago

Yeah I mean obviously the technical points here are correct (and I wish my colleagues would write more robust code with less Bash and regex all over the place), but I don't know why he thinks you need an asshole manager to deliver that message.

Over-engineered. Too many moving parts. Refactor.”

That was it. No “nice work.” No “good attempt”. Just a hard stop.

Uhm yeah, would writing "good attempt" have hurt? Obviously not. He could easily have been nice and still deliver the technical information.

Good attempt, but I think this is too over-engineered with too many moving parts. For instance x y z would be simpler to maintain, and a b c isn't robust to 1 2 3 for example.

It doesn't take much. Don't be a dick.

[-] FizzyOrange@programming.dev 10 points 3 months ago

What on earth are you talking about? There's no enshittification here.

[-] FizzyOrange@programming.dev 10 points 5 months ago

How extreme do you have to be to only use websites if they are open source?? That's roughly 0% of the web.

[-] FizzyOrange@programming.dev 10 points 7 months ago

you can say that without a spec as well but what does “wrong” mean then? It just means you personally disagree with its behavior.

Nope. Specs can have bugs. Here are the bugs in the C++ spec for example:

https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_toc.html

As I said, specifications are useful and desirable, but the SIL's dogmatic "no spec = unsafe" is clearly not based in reality.

[-] FizzyOrange@programming.dev 10 points 8 months ago

Oh cool how do I run VSCode in Termux?

[-] FizzyOrange@programming.dev 10 points 9 months ago

Yeah, honestly you should stick to if/else until you're really sure you want to do something more complex.

[-] FizzyOrange@programming.dev 10 points 10 months ago

I've heard they also removed good reviews if you don't pay them, so... yeah I don't think you can really learn anything from TrustPilot.

[-] FizzyOrange@programming.dev 10 points 10 months ago

I disagree. It's a sign your code isn't structured in a way that the borrow checker understands, but that is a subset of well-structured code.

In other words, if your code nicely fits with the borrow checker then it's likely well structured, but the inverse is not necessarily true.

One thing I always run into is using lambdas to reduce code duplication within a function. For example writing a RLE encoder:

fn encode(data: &[u8]) -> Vec<u8> {
  let mut out = Vec::new();

  let mut repeat_count = 0;

  let mut output_repeat = || {
     out.push(... repeat_count ...);
  };

  for d in data {
      output_repeat();
      ...
  }
  output_repeat();
  out
}

This is a pretty common pattern where you have a "pending" thing and need to resolve it in the loop and after the loop. In C++ you can easily use lambdas like this to avoid duplication.

Doesn't work in Rust though even though it's totally fine, because the borrow checker isn't smart enough. Instead I always end up defining inline functions and explicitly passing the parameters (&mut out) in. It's much less ergonomic.

(If anyone has any better ideas how to solve this problem btw I'm all ears - I've never heard anyone even mention this issue in Rust.)

view more: ‹ prev next ›

FizzyOrange

joined 2 years ago