HNHacker News
TopNewBestAskShowJobs

nightcracker

4,235 karma · joined March 27, 2013

submissionscomments
nightcracker··on QOI: Lossless Image Compression in O(n) Time
Yes, I am aware it has been 'superseded' but in my experience for lossless compression it's still usually better.
nightcracker··on QOI: Lossless Image Compression in O(n) Time

    QOI_DIFF24 {
        u8 tag  :  4;   // b1110
        u8 dr   :  5;   // 5-bit   red channel difference: -15..16
        u8 dg   :  5;   // 5-bit green channel difference: -15..16
        u8 db   :  5;   // 5-bit  blue channel difference: -15..16
        u8 da   :  5;   // 5-bit alpha channel difference: -15..16
    }
It bothers me more than it should that the 5-bit signed differences aren't -16..15 matching two's complement but -15..16 instead.
nightcracker··on QOI: Lossless Image Compression in O(n) Time
You could still stream the pixels, you'd just have to stream them in Z order. This may seem pedantic, but this applies to any mismatch between the order in which you store pixels and the order in which the format stores pixels.

E.g. some file formats may be row-major, others column-major, some block-based (like JPEG) or a fancy interleaving scheme (like Adam7). Some might store the channels interleaved, others separate the channels. If any of these choices doesn't match the desired output format, it breaks streaming.

nightcracker··on Hackerrank DMCA Notice
Copying the question text verbatim certainly is copyright infringement (and I would guess unlikely to be fair use, but I'm not a lawyer). If you give the problem in your own words, it won't be, just like your solution isn't.
nightcracker··on Rust data structures with circular references
I don't know, only have some theories.

1. The name isn't particularly catchy or descriptive. It is the correct name for the data structure, but not too many people know the data structure.

2. People don't even know what they're missing. It's not a very Google-able problem to begin with. Slotmap provides an interesting solution to (circular) ownership and safe allocator / weak pointer design problems, but people don't recognize that they're having them or that slotmap could help.

As an example of this, the doubly linked list example (https://github.com/orlp/slotmap/blob/master/examples/doubly_...) can safely remove nodes from the linked list given their handle, in O(1), even from the middle, completely safely and correctly, even in the presence of double deletions or ABA memory re-use. You can't replicate this with just pointers, without introducing heavy refcounting solutions.

nightcracker··on Rust data structures with circular references
SlotMap literally cannot, because it must keep track of versions of the used slots, and the slots include the memory space for the data.

DenseSlotMap sort of can. It still can't reclaim the memory used by empty slots for the same reason (at a cost of 8 bytes per slot), but can reclaim the memory used by the actual elements stored.

So if you store 1 million items at one point in a DenseSlotMap, and then clear them all and then shrink to fit (which is actually missing from the API, but I'll fix that soon) you will waste 7.6 megabytes on the empty slots but nothing on the actual data that used to be stored.

nightcracker··on Rust data structures with circular references
There is no fragmentation whatsoever in the traditional sense (unusable gaps left due to size mismatches), because a slotmap only stores a single type of value. Thus every slot is interchangeable and memory can always be reused.

For iteration however, there can be holes that need to be ignored, if the current number of elements in the slotmap is significantly lower than the the maximum capacity. If iteration needs to be very fast (for e.g. game engines) I do have a solution for that, which is the DenseSlotMap. It uses one extra layer of indirection for random access, but stores the actual data values contiguously in a vector, thus iteration is always fast.

nightcracker··on Hop: Faster than unzip and tar at reading individual files
> It's not hard being faster than zip if you are not compressing/uncompressing

Actually, since CPUs are so fast and disk IO is so slow, it is essentially impossible to beat a properly tuned program that reads data from disk and decompresses it on the fly using one that doesn't use compression at all.

nightcracker··on Google sends anti-regulation propaganda to small businesses using Google Maps
If a significant amount of your new customers find your physical shop through Google maps, what can you do? If someone wants to find a hardware store near them, good chance they'll just write "hardware store" on Google maps. The entry point of people's search is Google - you've already lost the game before it ever started.
nightcracker··on Algorithm accurately predicts when teens have suicidal thoughts, behavior
I did miss that, oops. That said, it's again unclear if that curve is pre- or post- biased sampling. If it is on the original data it is quite good, but with a heavy biased sample fairly meaningless.
nightcracker··on Algorithm accurately predicts when teens have suicidal thoughts, behavior
Very sloppy statistics. A lot of explanatory analysis on the model is done but the model is hardly justified in being predictive in the first place.

The paper (https://journals.plos.org/plosone/article?id=10.1371/journal...) [does not mention the sensitivity or specificity of the model at all, only mentions a '91% accuracy' number]* on a biased dataset (where the number of suicidal cases is oversampled and non-suicidal cases are undersampled), without even mentioning exactly how much they over/undersampled.

* I missed the ROC curve on page 7. However it's not clear if this ROC curve was computed on the under/oversampled dataset or the original.

nightcracker··on Why is Excalidraw so good?
No, it is a Pokémon reference to the very similarly named Excadrill.
nightcracker··on Why is baseball the most literary of sports?
Softball is a bigger ball, yes. But it's not lower velocity, at least if you consider the relevant metric: time from pitcher to plate. Because softball also pitches a lot closer to the plate.
nightcracker··on The 50-year-old P-NP problem that eludes theoretical computer science
See my other comment, it would also immediately be constructive: https://news.ycombinator.com/item?id=29022963
nightcracker··on Apple Joins Blender Development Fund
From what I have read (I don't do 3D modeling myself) Blender has overhauled its UI significantly over the past couple of years to great praise of a lot of people.
nightcracker··on Ireland joins OECD International Tax agreement
I would guess that India is too large to meaningfully include in such a statistic. On average in the country English literacy could be quite poor while in the relevant tech hubs it is quite good. But that's just a hypothesis.
nightcracker··on All 16,777,216 RGB colours (2005)
> I can zoom in and see lots of different colors

If you zoom in further, you'd soon realize your screen is nothing but pure red, green and blue subpixels at varying intensities.

nightcracker··on All 16,777,216 RGB colours (2005)
PNG is lossless, so it really does.
nightcracker··on Lab-grown meat may never be cost-competitive enough to displace traditional meat
Here in the Netherlands it's the exact opposite. We have infinite water, just not a lot of space.
nightcracker··on Turing Oversold?
> and proving that a very simple physical machine can perform any computation (Turing completeness)

Not proving, conjecturing. It's not proven until this day: https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis

nightcracker··on The number of legal chess positions estimated at 4.5x10^44 – proof games wanted
Which begs the question: without the fifty-move rule (only threefold repetition), what is the longest legal chess game?
nightcracker··on Dogs distinguish human intentional and unintentional action
Experimental science is all based around ruling out the null hypothesis. For that it needs to be falsifiable.

The hypothesis 'the dog can differentiate between A and B' is very hard to falsify. Because the dog could differentiate, but choose to not act. You would need a fairly complete understanding of the dogs mental workings, and scanners to study them.

On the other hand, 'the dog can't differentiate between A and B' is much easier to falsify. If you repeat an experiment a sufficient amount of times and the dog consistently has different behavior between A and B, you can rule this null hypothesis out.

That is the real reason we always 'assume the worst'. Because 'assume the worst' is the easiest to scientifically rule out.

EDIT: I would suggest this video by Veritasium, which also touches on this, at a very fundamental level: https://www.youtube.com/watch?v=vKA4w2O61Xo.

nightcracker··on Major Quantum Computing Advance Made Obsolete by Teenager (2018)
One thing that is very hard if not impossible for the human mind is to 'unsee' stuff. Once you have learned a certain method or theory it becomes almost impossible to think creatively about a problem and attack it from different angles, because you already know what works.

Repeated exposure also reduces skepticism. The writing world has already long known this, you can not proofread your own work. You will read 50 times over a silly mistake without ever noticing it. Software engineering is understanding this more and more through code review as well, but academia is slow on the uptake. Groups or individuals will spend months on their work without anyone else to check on it.

The young are not yet cursed with knowledge. They can look at things with a fresh look. They can poke holes in stuff others are 'reading over', and find completely new approaches.

nightcracker··on Many young people diagnosed with Tourette’s after watching a YouTube channel
It's a bit of a catch 22. On a surface level one might say that they are faking having Tourette's, and that they are completely healthy. But look a bit deeper and you realize that a mentally sane person would not copy the tics from a YouTube personality and keep the schtick up all the way to the doctors. So no, it's not Tourette's but yes, these people need help.
nightcracker··on Z3 approach to discover that “q_rsqrt” is in Copilot's slur list
Other slurs include "man", "woman", "israel", "socialism" and "communist".
nightcracker··on Windows 11: a survey of text boxes
80% of the time if I want to change something in the Windows 10 settings all my time is spent trying to find out which magic words I need to recite and which buttons I need to click to get to the old Windows 7 / XP style configuration dialogs.

E.g. you have to navigate through this garbage: https://i.imgur.com/W1txUAK.png to find the one link (named "Sound Control Panel", hidden somewhere down the page) that opens the actual useful config panel: https://i.imgur.com/zDnnMPE.png

nightcracker··on Nuitka: An extremely compatible Python compiler
I think the idea behind Nuitka is to compile Python into an executable, rather than interpret a script using a fully generic interpreter, but without (or with minimal) limitations, falling back to libpython's implementation if necessary.

> In the future Nuitka will be able to use type inferencing based on whole program analysis. It will apply that information in order to perform as many calculations as possible in C, using C native types, without accessing libpython.

I believe the difference with PyPy is that PyPy tries to do this using just-in-time compilation and nuitka uses ahead-of-time compilation.

nightcracker··on Windows 11 available on October 5
Yes they think this, but not in the way you or I think about it. At least this is my admittedly cynical take. There is a strong push across tech to erase the concept of a Personal Computer, and make everything function like a tablet. Calling tablets/phones PCs is part of this, by muddying the water, as well as attempts like these: https://www.youtube.com/watch?v=zfR_Jj4grZE

Interfaces and functionality keep being dumbed and locked down like they are on tablets and phones. Microsoft and Apple are watering at the mouth for the day when the true personal computer is gone and every computing device is a walled garden where every user uses their pre-approved apps doing only the pre-approved tasks, preferably as thin clients into their controlled cloud.

nightcracker··on The end of phone calls: why young people have silenced their ringtones
This might just be the most hard to read article I've ever seen.
nightcracker··on Fundamental physics sees worlds in grains of sand and infinities in hours
We could build modern society strictly crawling, without language we would still be hunter gatherers in small packs.
Page 1 of 25Next →