Hacker News

New stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Network science reveals structure, lasting impact of Roman road system(nature.com ↗)
    discuss
  2. Nuclear Fusion's Moment of Truth(ft.com ↗)
    discuss
  3. CUDA Rust: Two Tracks for Writing GPU Kernels(nvidia.com ↗)
    discuss
  4. Bypassing inference bottlenecks: Accelerating complex AI search(research.google ↗)
    discuss
  5. Horace Dediu: The Dawn of Gestural Computing(asymco.com ↗)
    discuss
  6. Why Does the Universe Expand?(cosmicave.org ↗)
    discuss
  7. Ask HN: Do you still use Sass for website development
    discuss
  8. Did Wildfires Spark the Invention of Pottery?(nautil.us ↗)
    discuss
  9. macOS 27 Golden Gate: The Ars Technica Review(arstechnica.com ↗)
    discuss
  10. The Mind-Bending Joyrides That Gave Rise to Tesla(ieee.org ↗)
    discuss
  11. Show HN: Fail2zig. A single-binary fail2ban replacement written in Zig(fail2zig.com ↗)
    discuss
  12. The Railways Killed a Medieval Law [the Deodand](jstor.org ↗)
    discuss
  13. What we measured about "abandoned" software before trying to make money from it(github.com/constraint-works ↗)
    discuss
  14. EU to restrict social media and chatbots for children under 15(ft.com ↗)
    discuss
  15. Reid Hoffman – AI for All Americans(reidhoffman.substack.com ↗)
    1comments
  16. My MCP Server Dropped One Call in Four(datasignalslab.com ↗)
    discuss
  17. Hacking the NuPhy Air60 keyboard: part 3(carlossless.io ↗)
    discuss
  18. One of China's Most Powerful AI Models Has Also Escaped Containment(wired.com ↗)
    discuss
  19. Show HN: A game where the level is whatever web page you're on(page-rage.com ↗)
    discuss
  20. Forgery of C2PA on a Pixel 10(hackerfactor.com ↗)
    discuss
  21. Flock (YC S17) dumped by Boston for sharing data in violation of contract(arstechnica.com ↗)
    1comments
  22. I Found One Interesting Open Source GitHub Gem(github.com/maximhq ↗)
    discuss
  23. OpenAI's rogue agents probed Hugging Face weaknesses months before major hack(reuters.com ↗)
    discuss
  24. You Can't Buy Ada Compliance with a Widget(complyy.io ↗)
    1comments
  25. Panel Discussion: AI in Mathematical Research – Heidelberg Laureate Forum [video](youtube.com ↗)
    discuss
  26. C++26: Trivial infinite loops are no longer undefined behaviour(sandordargo.com ↗)
    discuss
  27. Open Letter to Sir Paul Nurse, President of the Royal Society(docs.google.com ↗)
    discuss
  28. Convert Your Chatbot's Markdown to Discord-Complaint Markdown(markdowntodiscord.com ↗)
    discuss
  29. Flet 1.0 released: build desktop, mobile, and web apps in Python(flet.dev ↗)
    1comments
  30. The ZSA Backpack(feedbinusercontent.com ↗)
    1comments

Vectorized and performance-portable Quicksort

127 pointsby 1h agoopensource.googleblog.com
16 comments
1h agoHN ↗

Very nice. Let's see Paul Allen's quicksort

1h agoHN ↗

(2022)

If you're curious why you would want a vectorized way to sort lists of numbers, one use case is building histograms - it's much easier to build a histogram if you've sorted all your samples first

1h agoHN ↗

(2002)

I wonder what apps have implemented this now that a few years have passed.

55m agoHN ↗

Actual title: “Vectorized and performance-portable Quicksort” (2022).

Actual sense in which it’s first:

Happily, modern instruction sets (Arm SVE, RISC-V V, x86 AVX-512) include a special instruction suitable for partitioning. Given a separate input of yes/no values (whether an element is less than the pivot), this "compress-store" instruction stores to consecutive memory only the elements whose corresponding input is "yes". We can then logically negate the yes/no values and apply the instruction again to write the elements to the other partition. This strategy has been used in an AVX-512-specific Quicksort. But what about other instruction sets such as AVX2 that don't have compress-store? Previous work has shown how to emulate this instruction using permute instructions.

We build on these techniques to achieve the first vectorized Quicksort that is portable to six instruction sets across three architectures, and in fact outperforms prior architecture-specific sorts.

50m agoHN ↗

Our implementation uses Highway's portable SIMD functions, so we do not have to re-implement about 3,000 lines of C++ for each platform.

Would they do the same thing today or have an LLM re-implement those 3000 lines of c++ ?

46m agoHN ↗

Id say that it is a lot more likely for the in-house, at least half a decade old library to be correct and performant than 3000 lines of an LLMs mediocre regurgitation of that code.

41m agoHN ↗

Guys, remember when language features allowed re-usability?

48m agoHN ↗

Well, it came out a while ago, so maybe we can be a bit silly:

There’s something sort of beautiful about mergesort and heapsort. Their names tell you what their main idea is, and how they work is immediately obvious.

Quicksort, on the other hand, has nothing beautiful about it and is named after it’s one redeeming feature (that it is quick for a lot of cases).

15m agoHN ↗

The beauties of quicksort are that it sorts in-place and that it is embarrassingly simple.

The in-place property can be utilized to make it very close to cache-oblivious algorithm.

15m agoHN ↗

How is it less beautiful?

Honest question, curious to hear about what that means to you.

13m agoHN ↗

Maybe if Hoare had called it Partitionsort in 1960, the name wouldn’t have been memorable enough to catch on and become so popular.

46m agoHN ↗

Definitely needs (2022) in the title, I was a bit confused!

37m agoHN ↗

only sorts numbers? wouldn't radix be much better?

34m agoHN ↗

Just imagine when candidates will get asked by pre-revenue startups to implement a vectorized version of quick-sort in person in 10 mins, just for a SWE job which they do not use this themselves.

Only the likes of MAG 7, and a couple of hedge-funds would ask to do it since this problem directly applies to them.

But certainly not pre-revenue startups.

34m agoHN ↗

this was made like 4 years back most of the current algorithms use this already !