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.

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

  • as a computer engineer myself, I'm aware of these. However, these indicate the difference with an engineering aspect. Whereas, I ask about some parts of the code as the hashing algorithm. Because as someone working on computer vision time to time; I experienced 70x times acceleration before just by taking a part of code into assembly. So; I guess what you say is because of the obvious reasons nobody really tried to implement? – Süha Boncukçu Dec 25 '17 at 6:52
  • @Suha - You can use gcc to produce an asembly file from the cryptonote source and then try optimizing it (rather than writing from scratch) if you believe you can improve upon speed. I guess you could look out for stuff the compiler doesn’t handle efficiently regarding cryptonote (maybe floating points? I dunno). If you do manage to speed it up significantly do a pull request on the github and the team will check it out – Zigglzworth Jan 22 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.