Better HN
topnewbestaskshowjobs
Log inSign up

throw2030401

4 karma · joined Feb 17, 2025 (1y ago) · 3 submissions

Submissions

comment 1y ago · link · parent

However the output of llvm-mos on godbolt is garbage

comment 1y ago · link · parent

It is clearly not what their charts are based on though.

Their example output

  jsr fn
  eor #5
  ldx #3
  sax S
  sec
  sbc S
  rts
Is better but not drastically so than the output of another 6502 compiler on godbolt:

  _kekw_sloc0_1_0:
          .ds 1
  _kekw:
          jsr     _fn
          eor     #0x05
          tax
          and     #0x03
          sta     *_kekw_sloc0_1_0
          txa
          sec
          sbc     *_kekw_sloc0_1_0
          rts

comment 1y ago · link · parent

While this is very impressive there is an important qualifier missing from the article.

They are NOT comparing the output from the same programming languages and so probably not the same source code either.

- Their compiler uses a custom language (NesFAB) and does NOT support C

- The reference compilers are all using C

"NESFab is a new programming language for creating NES games. Designed with 8-bit limitations in mind, the language is more ergonomic to use than C, while also producing faster assembly code."

And http://pubby.games/nesfab/doc.html#_what_is_nesfab

Presumably they made a best effort to implement their algorithm as closely as possible in the two languages, but that's a lot different than comparing the output of compilers using identical input source code.

So instead of saying

- "In a bizarre twist, my compiler generates faster code than GCC, LLVM, and every other compiler I compared it to."

It would be more accurate to say

- " In a bizarre twist, my compiler [and language] generate faster code than GCC, LLVM, and every other compiler I compared it to [using C].