HackerTrans
TopNewTrendsCommentsPastAskShowJobs

orlp

8,717 karmajoined 13년 전
Developer at https://pola.rs/.

Publish a blog at https://orlp.net/blog/.

Other socials:

    http://github.com/orlp/  
    https://stackoverflow.com/users/565635/orlp  
    https://linkedin.com/in/orson-peters/

Submissions

Rust Is Perfectly Imperfect

0x80.pl
3 points·by orlp·6개월 전·1 comments

When Random Isn't

orlp.net
376 points·by orlp·2년 전·147 comments

comments

orlp
·7시간 전·discuss
That's a GCC skill issue. You can do it in five branchless instructions for unsigned by splitting the unsigned up in two 32-bit halves, converting those to floats simply by inserting their values as mantissa into constants 2^52 and 2^(52 + 32). This conversion is exact.

Then to finish the conversion you subtract 2^52 and 2^(52 + 32) respectively from the halves and add them together.

    vmovq       xmm0, rdi
    vpunpckldq  xmm0, xmm0, xmmword ptr [rip + .CONST1]
    vsubpd      xmm0, xmm0, xmmword ptr [rip + .CONST2]
    vshufpd     xmm1, xmm0, xmm0, 1
    vaddsd      xmm0, xmm1, xmm0
Here CONST1 = [0x43300000, 0x45300000, 0, 0] and CONST2 = [0, 0x43300000, 0, 0x45300000].
orlp
·8시간 전·discuss
Don't give these ghouls ideas.
orlp
·5일 전·discuss
First, this article is mostly (AI?) regurgitation. This is much better: https://smalldatum.blogspot.com/2026/01/common-prefix-skippi....

Second, I have independently invented this (quicksort on string prefixes) at my time at CWI, although I didn't end up publishing it, because...

Third, this was already published in the original 1961 Quicksort paper by Hoare: https://www.cs.ox.ac.uk/files/6226/H2006%20-%20Historic%20Qu.... Near the end, the section on "Multi-word keys" describes a quicksort that partitions on just the first word, and only accesses the next word for the equality partition. And funnily enough this paper credits P. Shackleton for this, thus this idea was thought of even before the Quicksort paper came out.

So as is usual for software patents, this patent never should have been awarded.
orlp
·13일 전·discuss
This is a dumb take. It's like not teaching kids 1 + 1 because a calculator can do it for them.
orlp
·13일 전·discuss
If your data is sufficiently noisy or your relationship sufficiently simple a linear regression will outperform a SOTA LLM.
orlp
·16일 전·discuss
It seems like there aren't extra duties (anymore), but then again it's all very confusing and hard to navigate so who knows.
orlp
·16일 전·discuss
You save a lot less after paying import duties.
orlp
·18일 전·discuss
Actually, they're making an effort to force your business to not do something.
orlp
·30일 전·discuss
> Is there really anything about them that's bad? Or any worse than other things?

A full-on nuclear war will literally make a large portion of our planet uninhabitable for anyone for centuries, and leave the rest severely crippled and contaminated.

Sorry I know we're supposed to be kind and whatnot in these comments but I can't help but explicitly state that your comment is one of the dumbest things I've read on this site in a while. I hope you otherwise have a good day.
orlp
·지난달·discuss
https://en.wikipedia.org/wiki/Conscription_in_Iran

FWIW I don't agree with the comment chain's source, I read "regular people" as "civilians" and don't think there was any nasty connotation meant.
orlp
·지난달·discuss
Copyright being as long as it is is a theft of our culture. I (and many of our generation) grew up with Pokemon, it's a common experience for many of us. A classic of our culture. Except we're not allowed to use it, remix it, build our own versions, etc. We still do, of course, but it's all illegal.

It didn't used to be this way.

I think 20-30 years of copyright should be plenty to extract whatever profits you deserve from the fruits of your labor. Anything beyond that is just holding culture hostage for the benefit of a few. It doesn't serve society in any meaningful way.
orlp
·지난달·discuss
It's just a play on words, something lightweight drifts in the wind rather than gliding on a wing. It's really not all that deep.
orlp
·지난달·discuss
It's called driftsort because it's derived from another sort I made, glidesort: https://github.com/orlp/glidesort. Glidesort is a bit faster still for large inputs, however it was too large and complex for inclusion in the standard library, and suffered from code size penalties on small inputs. So driftsort is a slimmed down version more appropriate for general purpose.
orlp
·지난달·discuss
Since pdqsort (an older project of mine) was mentioned, I felt it wouldn't be entirely inappropriate to mention that I've since then collaborated with Lukas Bergdoll to provide two high-quality sort implementations for the Rust standard library, ipnsort (unstable) and driftsort (stable).

So if you use Rust, you get these by simply calling [T]::sort(_unstable). Great performance out of the box :)

On my machine (Apple M2), using the benchmarks from the repository on Apple clang 17 and Rust 1.98 nightly:

    Sorting 50 million doubles:
    ipnsort             0.79s
    blqs                0.90s
    driftsort           1.13s   (stable)
    std::sort           1.22s
    std::stable_sort    4.64s   (stable)

    Sorting 50 million (i32, i32) structs:
    ipnsort             0.82s
    blqs                0.89s
    driftsort           1.07s   (stable)
    std::sort           3.09s
    std::stable_sort    3.15s   (stable)

And now for a cool party trick, let's repeat the 50 million doubles experiment again, but have the first 90% already sorted, last 10% random:

    driftsort           0.29s   (stable)
    ipnsort             0.81s
    std::sort           1.15s
    std::stable_sort    1.63s   (stable)
    blqs                1.89s
orlp
·지난달·discuss
When going from float to u8 you should add a triangular dither. It makes a world of difference for grayscale gradients, even in 24bit truecolor.
orlp
·지난달·discuss
The input space is 32 + 32 = 64 bits. The output space is 64 bits. So the best you can do is an 1-to-1 mapping.

However, since a * b = b * a, our input space has a lot of duplicate outputs. So from this alone you can conclude roughly half of the output space must be uncovered by any input pair, simply because there aren't enough input pairs.
orlp
·2개월 전·discuss
There's typically only a performance penalty if the unaligned load spans a cache line on modern hardware.
orlp
·2개월 전·discuss
No it doesn't have security implications.

If you are insecure because someone has had one of their otherwise completely innocent PRs merged into your repo... you are insecure, period.
orlp
·2개월 전·discuss
The person you replied to was talking about selling, not buying.
orlp
·2개월 전·discuss
> So you're just outright accusing GameStop of fraud?

I have no idea why you interpret my words that way. I just meant that I didn't want to analyze the cash portion of their offer any further and just wanted to take it at face value.