Skip Navigation
Rust just merged two new very fast sort implementations into stdlib
  • Yeah, sorting is definitely a common use case, but note it also didn’t improve every sorting use case. Anyway, even if I’m a bit skeptical I trust the Rust team that they don’t take these decisions lightly.

    But the thing that lead to my original question was: if the compiler itself uses the std sorting internally, there’s also additional reason to hope that it might have transitive performance benefits. So even if compiling the Rust compiler with this PR was actually slower, compiling again with the resulting compiler could be faster since the resulting compiler benefits from faster sorting. So yeah, fingers crossed 🤞

  • Rust just merged two new very fast sort implementations into stdlib
  • Yeah, it was the first line of the linked PR:

    This PR replaces the sort implementations with tailor-made ones that strike a balance of run-time, compile-time and binary-size, yielding run-time and compile-time improvements.

    It was also repeated a few paragraphs later that the motivation for the changes was both runtime and compile time improvements. So a little bit bumped to hear the compile time impact wasn’t as good as the authors hoped apparently. I’m not even sure I fully endorse the tradeoff, because it seems the gains, while major, only affect very select use cases, while the regressions seem to affect everyone and hurt in an area that is already perceived as a pain point. But oh well, the total regression is still minor so I guess we’ll live with it.

  • Rust just merged two new very fast sort implementations into stdlib
  • The post mentioned that the introduction of these new algorithms brings compile-time improvements too, so how should I see this? I assumed it meant that compiling applications that use sorting would speed up, but that seems like a meaningless improvement if overall compilation times have regressed. Or do you mean compiling the compiler has become slower?

  • Rust just merged two new very fast sort implementations into stdlib
  • Does the Rust compiler use their std sort algorithms, or does it already use specialized ones? If the former, it would be a great side-effect if the compiler itself receives additional speed ups because of this.

  • i built a compression lib in cpp
  • For a little bit I thought this library might be a subtle joke, seeing the #define _SHITPRESS_H at the start. That combined with the compress() and decompress() not taking any arguments and not having a return value, I thought we were being played. Not to mention the library appears to be plain C rather than C++... surely the author should know the difference?

    Then I saw how the interface actually works:

    // interface for the library user, implement these in your program:
    unsigned int SPR_in(); // Return next byte from input or value > 255 on EOF.
    void SPR_out(unsigned char); // Output byte.
    

    This seems extremely poorly thought out. Calling into global functions for input and output means that your library will be a pain to use in any program that has to (de)compress anything more than a single input.

  • Post-Architecture: An Open Approach to Software Engineering
    arendjr.nl Post-Architecture: An Open Approach to Software Engineering

    On the implications of defining the architecture after you build the product

    This post highlights my experience working with software architecture in startup environments. I think the approach is different enough from the traditional notion of software architecture that it may warrant its own term: post-architecture.

    2
    C++
  • Smart pointers are really really nice, I do recommend getting used to them (and all other features from c++11 forward).

    You’re recommending him to give up his sanity and/or life?

  • Some notes on Rust, mutable aliasing and formal verification
  • The other day I saw a link to Verus on here and it’s made me somewhat interested in the topic how Rust and formal verification can work together.

    It’s quite insightful to see how the borrow checker both required and ended up facilitating the ability to do more extensive formal verification on Rust code.

    Something like Verus (I haven’t looked into most of the other tools in this space yet, there seem to be many!) does appear poised to make verification quite approachable in low-level, self-contained Rust code already, and I’m curious to see how things evolve from there.

    It would be exceedingly cool if one day there’s a subset of libraries on crates.io that are fully verified (similar to how today there’s a subset that supports no-std development) and which are then usable to build upon in your own formally verified code.

  • Leaving Rust gamedev after 3 years
  • I greatly fear refactoring in Rust. Making a single conceptual change can require a huge number of code changes in practice, especially if it’s a change to ownership.

    I think this is a fair criticism, but I think you and the poster you responded to are talking about different things. Usually when people use the term “fearless” in relation to Rust, it means the language provides a high level of confidence that what you’re delivering is free of mistakes. This certainly applies to refactoring too, where usually after you are done, and things compile again, you can be reasonably confident things work as before (assuming you didn’t make other changes the type system can’t catch for you).

    The kind of fear you are describing sounds more like a discouragement because of the amount of work ahead of you. That’s fair, because Rust does sometimes make things harder. I just think many Rust developers will disagree with you, not because you’re wrong, but because they may not feel the same type of discouragement, possibly because they’ve learned to appreciate the rewards more.

  • "I want to live forever in AI"
  • Agreed on all counts, except it being useless to think about :) It’s only useless if you dismiss philosophy as interesting altogether.

    But that kinda misses the point, right? Like, all that means is that the observation may have created the particle, not that the observation created reality, because reality is not all particles.

    I guess that depends on the point being made. You didn’t raise this argument, but I often see people arguing that the universe is deterministic and therefore we cannot have free will. But the quantum mechanical reality is probabilistic, which does leave room for things such as free will.

    I can agree with your view to say observation doesn’t create reality, but then it does still affect it by collapsing the wave function. It’s a meaningful distinction to make in a discussion about consciousness, since it leaves open the possibility that our consciousness is not merely an emergent property of complex interaction that has an illusion of free will, but that it may actually be an agent of free will.

    And yes, I fully recognise this enters into the philosophical realm and there is no science to support these claims. I’m merely arguing that science leaves open a path that enters that realm, and from there it is up to us to make sense of it.

    There is the philosophical adage “I think therefore I am”, which I do adhere to. I know I am, so I’ll consider as flawed any reasoning that says I’m not. Maybe that just makes me a particularly stubborn scientific curiosity, but I like to think I’m more than that :)

  • "I want to live forever in AI"
  • can you define physical for me?

    The distinction I tend to make is between physical using the classical definition of physics (where everything is made of particles basically) and the quantum mechanical physics which defies “physical” in the classical sense. So far we’ve only been able to scientifically witness quantum physics in small particles, but as you say, there’s no reason it can’t apply at a macro scale, just… we don’t know how to witness it, if possible.

    it doesn’t require an observer to collapse the wave function

    Or maybe it does? The explanation I have for us being unable to apply the experiments at a larger scale is that as we scale things up, it becomes harder and harder to avoid accidental observation that would taint the experiment. But that’s really no more than a hunch/gut feeling. I would have no idea how to prove that 😅

  • "I want to live forever in AI"
  • In fact, one of the great mysteries of physics right now is why only quantum objects have that property, and in order to figure that out we have to figure out what interaction “observation” actually is.

    This does not stroke with my understanding of quantum physics. As far as we know there is no clear distinction between “quantum objects” vs “non-quantum objects”. The double slit experiment has been reproduced with molecules as large as 114 atoms, and there seems no reason to believe that would be the upper limit: https://www.livescience.com/19268-quantum-double-slit-experiment-largest-molecules.html

    This proves that the wave is in fact real, because we can see the effects of it.

    The only part that’s proven is the interference pattern. So yes, we know it acts like a wave in that particular sense. But that’s not the same thing as saying it is a wave in the physical sense. A wave in the classic physical sense doesn’t collapse upon observation. I know it’s real in an abstract sense. I’m just questioning the physical nature of that reality.

  • "I want to live forever in AI"
  • Thanks, that seems a fair approach, although it doesn’t have me entirely convinced yet. Can you explain what the physical form of a wave function is? Because it’s not like a wave, such as waves in the sea. It’s really a wave function, an abstract representation of probabilities which in my understanding does not have any physical representation.

    You say the building does not start acting like a wave, and you’re right, that would be silly. But it does enter into a superposition where the building can be either collapsed or not. Like Schreudinger’s cat, which can be dead or alive, and will be in a superposition of both until observation happens again. And yes, the probabilities of this superposition are indeed expressed through the wave function, even though there is no physical wave.

    It’s true observation does not require consciousness. But until we know what does constitute observation, I believe consciousness provides a plausible explanation.

  • Biome v1.7
    biomejs.dev Biome v1.7

    Migrate from Prettier and ESLint with one command!

    Biome v1.7

    cross-posted from: https://programming.dev/post/12807878

    > This new version provides an easy path to migrate from ESLint and Prettier. It also introduces machine-readable reports for the formatter and the linter, new linter rules, and many fixes.

    1
    Biome v1.7
    biomejs.dev Biome v1.7

    Migrate from Prettier and ESLint with one command!

    Biome v1.7

    This new version provides an easy path to migrate from ESLint and Prettier. It also introduces machine-readable reports for the formatter and the linter, new linter rules, and many fixes.

    10
    Rust Optimization: `Vec::into_iter().collect()`

    I just had a random thought: a common pattern in Rust is to things such as:

    rs let vec_a: Vec<String> = /* ... */; let vec_b: Vec<String> = vec_a.into_iter().filter(some_filter).collect();

    Usually, we need to be aware of the fact that Iterator::collect() allocates for the container we are collecting into. But in the snippet above, we've consumed a container of the same type. And since Rust has full ownership of the vector, in theory the memory allocated by vec_a could be reused to store the collected results of vec_b, meaning everything could be done in-place and no additional allocation is necessary.

    It's a highly specific optimization though, so I wonder if such a thing has been implemented in the Rust compiler. Anybody who has an idea about this?

    15
    GritQL integration progress · Biome.js
    github.com GritQL integration progress · biomejs biome · Discussion #2286

    It's been almost two months since I originally proposed integrating GritQL into Biome. Since then a lot has happened. And a lot more remains to be done. With this post I hope to give a little bit o...

    GritQL integration progress · biomejs biome · Discussion #2286

    Just a progress update on a fun open-source project I'm involved with. Biome.js is a web toolchain written in Rust, and it provides a great excuse to play around with parsing technologies and other fun challenges :)

    0
    Productivity of Rust teams at Google

    Slide with text: “Rust teams at Google are as productive as ones using Go, and more than twice as productive as teams using C++.”

    In small print it says the data is collected over 2022 and 2023.

    124
    Unused lifetime parameter -- except it isn't

    I have a fun one, where the compiler says I have an unused lifetime parameter, except it's clearly used. It feels almost like a compiler error, though I'm probably overlooking something? Who can see the mistake?

    main.rs ```rs trait Context<'a> { fn name(&'a self) -> &'a str; }

    type Func<'a, C: Context<'a>> = dyn Fn(C);

    pub struct BuiltInFunction<'a, C: Context<'a>> { pub(crate) func: Box<Func<'a, C>>, } ```

    ```text error[E0392]: parameter 'a is never used --> src/main.rs:7:28 | 7 | pub struct BuiltInFunction<'a, C: Context<'a>> { | ^^ unused parameter | = help: consider removing 'a, referring to it in a field, or using a marker such as PhantomData

    For more information about this error, try rustc --explain E0392. error: could not compile lifetime-test (bin "lifetime-test") due to 1 previous error ```

    5
    Writing exhaustive switch statements in TypeScript
    arendjr.nl Writing exhaustive switch statements in TypeScript

    A little trick that can help make switch statements more type-safe

    Today I'm sharing a little trick that I like to use to make switch statements cleaner and more type-safe. Happy to hear other ideas!

    5
    In search of a better Bevy UI
    arendjr.nl In search of a better Bevy UI

    This post explores how we improved upon Bevy's out-of-the-box UI experience for our Sudoku Pi project

    As part of my Sudoku Pi project, I’ve been experimenting with improving the Bevy UI experience. I’ve collected most of my thoughts on this topic in this post.

    3
    A Deep Dive Into Fiberplane's Operational Transformation
    fiberplane.com A Deep Dive Into Fiberplane’s Operational Transformation - Blog

    How Fiberplane Notebooks implement Operational Transformation

    A Deep Dive Into Fiberplane’s Operational Transformation - Blog

    I wrote a post about how our Operational Transfomation (OT) algorithm works at Fiberplane. OT is an algorithm that enables real-time collaboration, and I also built and designed our implementation. So if you have any questions, I'd be happy to answer them!

    2
    InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)AR
    arendjr @programming.dev
    Posts 11
    Comments 75