Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Parley: Federated, decentralised chat that speaks plain IRC (mills.io)
    5comments
  2. Owed a billion dollars in Nvidia stock (colo.to)
    311comments
  3. Footguns with Postgres "at time zone 'UTC'" (bookofrevenue.com)
    22comments
  4. Intellectuals Are Fucking Idiots (markmanson.substack.com)
    8comments
  5. Thinking fast and slow in AI: The role of metacognition (2021) (arxiv.org)
    36comments
  6. Ember-1 (fireworks.ai)
    219comments
  7. When did Google get so weird? (sancho.bearblog.dev)
    740comments
  8. Nissan's third generation e-POWER powertrain (nissan-global.com)
    90comments
  9. SpaceX's Starship launching to orbit for first time ever today (space.com)
    6comments
  10. Prompting Claude Opus 5.5 (claude.com)
    103comments
  11. Malleable software: Restoring user agency in a world of locked-down apps (2025) (inkandswitch.com)
    47comments
  12. Made by Mechanical Means (felixrieseberg.com)
    7comments
  13. Functional Mechanical Sympathy [video] (youtube.com)
    2comments
  14. Alan Kay's answer to “Did the ENIAC have a BIOS”? (quora.com)
    42comments
  15. Self-Hosting on the Dark Web (alvarezrosa.com)
    82comments
  16. Lunar Terminator Paradox (secretsauce.net)
    54comments
  17. Three Days in August: What a DDoS Attack Exposed in Our Network (nine.ch)
    —discuss
  18. Guitar amp and effects pedal built on the Waveshare ESP32-S3-Touch-AMOLED-2.06 (github.com/dashersw)
    43comments
  19. The state of SIMD in Rust in 2026 (shnatsel.github.io)
    38comments
  20. Don't couple your Go code to GitHub (iain.rocks)
    116comments
  21. AI companies in race to demonstrate their model most threatening to humanity (thecivilian.co.nz)
    —discuss
  22. 37,500 border drawings: a map of the world as people remember it (habibicode.org)
    6comments
  23. In an $80 motel room, a discovery to shed light on the origins of life (nytimes.com)
    94comments
  24. Show HN: Lofi Cities – Pixel-art city nights with browser-generated lofi (loficities.com)
    112comments
  25. Deterministic Concurrency [video] (youtube.com)
    3comments
  26. There is more to code review than (automatable) detection (adaptivecapacitylabs.com)
    87comments
  27. What I did at Recurse Center (thill.me)
    33comments
  28. Imp is a full port of DSPy to the BEAM (github.com/deepfates)
    7comments
  29. Replacing the old battery on rechargeable bike lights (jvns.ca)
    96comments
  30. Reading’s Bayeux Tapestry (diamondgeezer.blogspot.com)
    20comments

Packing Binary Is Fun

24 pointsby 9h agohereticpleb.vercel.app
9 comments
5h agoHN ↗

Cool. And the next enlightening step would be to generate custom parser code from message schemas. So that when de-serializer reads a next field, it does not read what name and type it will be, it expects and fails if it's not. Safer and more compiler friendly.

5h agoHN ↗

Congratulations, your strings dont support Unicode and you just ignored probably more than 3/4 or more of the world's languages.

3h agoHN ↗

Schemas save you space, but then you lose the ability to understand the data without the schema. That's where JSON has always been handy despite its inefficiencies.

Of course you can get the same kind of thing in binary. I wrote a drop-in binary JSON replacement because it's easy to write a binary one that's twice as fast as simjson and yyjson. The important thing is to never give the drop-in replacement any extras that break roundtrip compatibility.

Was a fun little project to write, and quite useful for me: https://github.com/kstenerud/bonjson

2h agoHN ↗

Schemas save you space, but then you lose the ability to understand the data without the schema. That's where JSON has always been handy despite its inefficiencies.

Of course that’s orthogonal to using a text v binary representation, you can have a schema’d text format, and a self-describing binary format.

BSON, UBJSON, MessagePack and CBOR are binary but self-describing.

1h agoHN ↗

One of my favourite yak shaving adventures in a previous job was writing a parse in place UBJSON decoder for ~1MB of data on a device with about as much free memory. Fast (enough) access by key, binary search with a few shortcuts for the mostly numeric payload. It built an index of maybe 30 bytes to speed things along, but also to let it keep working on the tail of the old message whilst the new one was overwriting it's start.

Should the system design have required all this of a device with 4MB of memory? Probably not. But it worked, and I had a great time

1h agoHN ↗

I'm missing some important parts that I would argue any (binary)format needs.

  - a magic header
  - a version number
  - a crc or data corruption check

Additionally I would argue one would be better off writing a custom text parser instead of parsing a binary format in this case, this is similar to the debate about unixlike config vs windows regedit. I would prefer something other then json but sill readable as txt.

Even the json example provided at the bottom can be minified from 418 characters to 166 by replacing the field names with single characters and removing the spaces. Almost all of the savings in this format come from not including the the field names and having a position dependent layout. You can choose to have delimiters or arrange for a byte to indicate the type(+size) for example the following string encodes the example data almost (85bytes vs 80bytes) as efficient but is still readable and supports utf-8 interpretation.

  123456789;LeroyJenkins;60;alliance;p,100,200,300;i,999,1,1;i,45,100,0;a,s,120;a,a,45;

You may optimize it further by allowing recurring entries and allowing assumed values from a defined default and only sending delta's can be dependent on the type of data you are expecting.

  { "itemId": 999, "quantity": 1, "isSoulbound": false }
  i,999,1,0

could become:

  default = { "itemId": 0, "quantity": 1, "isSoulbound": false }
  { "itemId": 999}
  i,999
1h agoHN ↗

I also want to be a real developer so i just GZIP the JSON to make it binary.

58m agoHN ↗

There already exists a "binary analogy" of JSON called Protocol Buffers or Kiwi. They are pretty simple (a parser can be made in 2 kB of code). Wouold be great if the author compared his reinvented wheel with existing wheels :D