2

I've seen ethereum miner written in go, monero miners written in C, javascript. I wonder why wouldn't anyone write assembly code for a miner? At least for the hashing part.

Süha Boncukçu
  • 143
  • 1
  • 5

1 Answers1

2

The following was taken from here and expanded upon

  • C is easier to program in, compared to Assembly. There are obvious reasons not worth rehashing.

  • Being easier to use, C allows you to write programs faster. Generally these programs are also easier to debug and easier to maintain. Furthermore, it's easier to manage large, complex programs in C.

  • Often times, code generated by a compiler is equally as good (in terms of speed and efficiency) as hand-written assembler - if not better.

  • C is pretty darn low-level, and it's rare that you'll want to go much lower. Having an added layer of abstraction is rarely a bad thing.

  • When you do need to go lower, you can use Assembly, otherwise you can use C.

  • You can write Assembly in C-code, but not C in Assembly-code.

  • A C compiler applies optimisations reliably and systematically - not just when it notices the opportunity

  • Creating a miner is often done in a collaboration and there are far less assembly programmers out there

  • C++ (which extends C) and is popular with miner development further improves development time, organization, and collaboration

Zigglzworth
  • 587
  • 4
  • 11