r/AskComputerScience • u/Actual__Wizard • Sep 08 '26
Desperately Looking for Guidance on Verifying a New Sorting Algo
Hi, I'm an AI developer and I've been working on optimizing my system for 2 years now. It was never my intention to create a new sorting algo or to do any work in that area at all. As I optimized my system, I realized that what I had effectively done, is create a new sorting algo.
By comparison, at this time, it took my new algo, about 1-2 hours to process the same sized data, that timsort needs about 30 days to sort. I'm sorting a giant 30gb array that contains text tokens.
I understand that there's tons of algos out there and that there likely already is a faster algo, but I'm not an expert sorting algos, so I honestly have no idea what to do to verify this in a legitimate way that is convincing to other experts.
I have never published a paper before, please do not make strange assumptions of my knowledge of that process (I know how to read a paper and that's it.)
9
u/physical0 Sep 08 '26
Describe your algorithm in pseudocode or whatever language you prefer and I betcha some bright CS student will be able to tell you which algorithm you re-implemented
4
u/nuclear_splines Ph.D Data Science Sep 08 '26
So start there. Google Scholar some papers on new sorting algorithms. How do they describe their work? How do they benchmark it? How do they compare to prior art?
Do they start by describing the algorithm in pseudo code, maybe comparing and contrasting to the most similar algorithms? Do they write formal proofs of asymptotic runtime? Do they make arguments about parallelization or cache locality? If and when they test their algorithm empirically, are there common sets of inputs most scholars use? Do they test on certain kinds of hardware to demonstrate how the algorithm fares with different sized caches, or how it benefits from acceleration like vector instructions?
Read a dozen papers on sorting algorithms and I'll bet you can answer all of the above and have a good idea of how to convince other experts of your approach.
2
u/blorvik Sep 10 '26
30gb in 2 hours sounds more like the data structure than the sort
0
u/frogic Sep 09 '26
I took your numbers seriously and reproduced the problem. Here's what I did and what I found.
What I did. I generated a fake corpus matching your claim exactly: 167,863,639 rows, 6,061,752,179 tokens, 32 GB. Then I sorted every token three ways on a 32 GB laptop and checked that all three outputs were identical byte for byte. They were.
What I saw.
sort, the built-in Linux command, no code writtenWhat's going on. Three separate things, and I think each is an honest mistake rather than anything else.
sortcommand that ships with every Linux machine. Your speedup is real, but it's mostly from keeping the data in memory, not from the algorithm.sorted()inside each bucket, which is Timsort. So alphasort is bucketing plus Timsort. That's a fine, fast, well-known hybrid. It just isn't new. Nobody uses it as the defaultsort()in a programming language because it only works when you know the keys are text; Timsort has to work on anything.What a legitimate test would look like. Same file, same machine, your code against GNU
sortand againstsort | uniq -cfor the trigram counts. Publish the numbers with the row count and the hardware. If you beat those, that's worth writing up. Beating a Python list that's swapping to disk isn't a result anyone can use.None of this means you wasted your time. You found the fast technique on your own and you made your job run. But the name for it already exists, and the tool that does it already exists, and both are worth knowing before you write a paper.