Readit News logoReadit News
binarycoffee commented on Put a ring on it: a lock-free MPMC ring buffer   h4x0r.org/ring/... · Posted by u/signa11
viega · 3 months ago
Well, when I was doing the original work on it (about 5 years ago now), I spent a lot of time trying to find something else in the literature. I couldn't find anything that wasn't SPMC or MPSC, unless it had severe limitations, like not actually having a drop policy when full.

However, I definitely did not see the paper you've sited, but just spent a few minutes with the paper you cited. Section 5.2 seems to cover their version. It's far from clear what their algorithm is, but they are talking about page eviction; it doesn't seem like they're using even a single fixed array for the ring, but I'm not 100% sure because it's pretty light on any detail. a

binarycoffee · 3 months ago
I hope you won't mind my picking your brain: which MPSC ring buffer implementations did you find that does drop old items when full? I could only found implementations that are basically re-purposed MPMC, or that cannot deal with non-POD data (seqlock-based).
binarycoffee commented on Lox – Oxidized Astrodynamics – A safe, ergonomic astrodynamics library   github.com/lox-space/lox... · Posted by u/ElFitz
goku12 · a year ago
There is another crate in Rust named Nyx [1] that sounds very similar - an astrodynamics library with a Python wrapper. Anyone knows how they compare?

[1] https://github.com/nyx-space/nyx

binarycoffee · a year ago
LOX is apparently MPL, so a bit easier to work with than Nyx' AGPL, but still at odd with the MIT/Apache2 combo that has become the norm in the Rust world.
binarycoffee commented on Lox – Oxidized Astrodynamics – A safe, ergonomic astrodynamics library   github.com/lox-space/lox... · Posted by u/ElFitz
aero-glide2 · a year ago
I work on simulations in a satellite company and have been looking for a way to move out of c++. Thank you very much, will explore this.
binarycoffee · a year ago
Just curious, what kind of simulations do you work on (mission design?) and what libraries would you use in C++?
binarycoffee commented on Ask HN: Who is hiring? (February 2025)    · Posted by u/whoishiring
binarycoffee · a year ago
Asynchronics | Rust developer | ONSITE or hybrid (2+days/week) | Full time | Warsaw, PL

We are a young startup building digital twinning solutions for spacecraft validation & verification.

The ideal candidate would have a demonstrated track record with Rust or possibly C++/Haskell/*ML, a passion for space and a background in physics or a related field of engineering.

Please apply at: https://www.linkedin.com/jobs/view/4129163803/ or email us at office@[company name].com

binarycoffee commented on Using Pandoc and Typst to Produce PDFs   imaginarytext.ca/posts/20... · Posted by u/bribri
binarycoffee · a year ago
I can see why someone would prefer Typst over LaTeX when the source is written in Typst or LaTeX, but what are the advantages if your source document is in Markdown? Is there anything else beyond the (presumably) smaller install size of Typst?
binarycoffee commented on I was banned from the hCaptcha accessibility account for not being blind (2023)   michaels.world/2023/11/i-... · Posted by u/blindgeek
Spivak · a year ago
I hope the other lesson was the good email verification hygiene of making the user take an affirmative action and click a "verify email" button rather then send it unsolicited.

You essentially had an open public unauthed form that would send an email to any address you typed in it. Surely that alone raises some eyebrows.

binarycoffee · a year ago
Not a solution. Verification emails alone got a small web site I set up to be blacklisted within days. Most of the unwilling recipients presumably couldn't understand the language the verification email was written in and reported it as spam.
binarycoffee commented on Show HN: Whirlwind – Async concurrent hashmap for Rust   github.com/fortress-build... · Posted by u/willothy
SabrinaJewson · a year ago
AtomicWaker is much less bad, because it will only spin in the case that another thread has spuriously called `wake` – i.e. called `wake` despite that fact that the future it’s waking is in fact unable to progress.

In the common case, the waker side will operate some logic like:

    set_flag();
    atomic_waker.wake();
and the future will run:

    atomic_waker.register(cx.waker());
    if flag_is_set() {
        Poll::Ready(())
    } else {
        Poll::Pending
    }
Thus, even if `register` decides to “spin”, the flag will already be set, and so the future will not spin in reality (it may be polled unnecessarily, but this will only happen once).

I can’t immediately think of examples where support for spurious waking is necessary.

binarycoffee · a year ago
The producers of an MPSC queue may use an AtomicWaker::wake to signal to the consumer that a new item is ready. In this case all wake-ups are necessary (not spurious).
binarycoffee commented on Show HN: Whirlwind – Async concurrent hashmap for Rust   github.com/fortress-build... · Posted by u/willothy
conradludgate · a year ago
It does immediately put itself into the queue to be polled again. But that's no different in effect to a spin-lock. If you have other tasks in your runtime, this will be putting excess pressure on your scheduler
binarycoffee · a year ago
Another offender is AtomicWaker [1] which does the same on contention.

[1] https://docs.rs/atomic-waker/latest/atomic_waker/

binarycoffee commented on Show HN: Rust Web Framework   github.com/levkk/rwf... · Posted by u/levkk
iknowstuff · a year ago
such as?
binarycoffee commented on Approximating sum types in Python with Pydantic   blog.yossarian.net/2024/0... · Posted by u/woodruffw
carderne · 2 years ago
I think it would be useful to differentiate more clearly between what is offered by Python's type system, and what is offered by Pydantic.

That is, you can approximate Rusts's enum (sum type) with pure Python using whatever combination of Literal, Enum, Union and dataclasses. For example (more here[1]):

  @dataclass
  class Foo: ...
  @dataclass
  class Bar: ...
  
  Frobulated = Foo | Bar
Pydantic adds de/ser, but if you're not doing that then you can get very far without it. (And even if you are, there are lighter-weight options that play with dataclasses like cattrs, pyserde, dataclasses-json).

[1] https://threeofwands.com/algebraic-data-types-in-python/

binarycoffee · 2 years ago
I needed to reflect Rust enums and went a bit further with that approach. All variants are wrapped in a decorated class, where the decorator automatically computes the union type and adds de/serialization hooks for `cattrs`.

    @enumclass
    class MyEnum:
        class UnitLikeVariant(Variant0Arg): ...
    
        class TupleLikeVariant(Variant2Arg[int, str]): ...
    
        @dataclass
        class StructLikeVariant:
            foo: float
            bar: int

        # The following class variable is automatically generated:
        #
        # type = UnitLikeVariant | TupleLikeVariant | StructLikeVariant
where the `VariantXArg` classes are predefined.

u/binarycoffee

KarmaCake day308September 26, 2016View Original