Inaccurate cycles counting on HiFive1 Rev B using mcycle CSR

You are probably running code from flash which is slow. It will run faster if you use ITIM and DTIM. See for example Instruction per Cycle.