Hacker News new | past | comments | ask | show | jobs | submit login
Galaxy S3 ARMv7 benchmark: Rust, Ocaml, Haskell, Go, Racket, Lua, C# and Java (togototo.wordpress.com)
8 points by logicchains on Aug 5, 2014 | hide | past | favorite | 4 comments



It seems the Rust team is really optimizing the language for ARM chips.


They use the LLVM as the backend, which is quite well optimised. The relatively poorer performance of that program on x86 may just be a bug (as the x86 version is compiled with a slightly different version of the Rust compiler); the program uses recursion, which may not be a Rust idiom and hence may not be well tested for performance regressions.


It doesn't actually use recursion; it is tail recursion and LLVM optimises it to a loop:

  .LBB0_77:
  	movq	%rax, %rbx
  	movq	%rcx, %rax
  	addq	%rbx, %rax
  	incq	%rdx
  	movq	%rbx, %rcx
  	jne	.LBB0_77
The difference on x64-64 is the Rust is using 64-bit integers (`int` is pointer sized), while the C is only using 32-bit ones; changing them to the 32-bit `i32` to match the C makes Rust super-fast:

  75699
  LANGUAGE Rust 2167
  75699
  LANGUAGE C 2220 # gcc
  75699
  LANGUAGE C 2271 # clang
I opened https://github.com/logicchains/armfib/pull/1 .


Thanks. The tables have been updated to use the new values; I'm really surprised how much of a difference changing from int to int32 made.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: