3 ms·
Efficient C Code for ARM Devices
- jbarham 16y agoNever mind C, it's nice to see the Go ARM compiler coming along nicely (http://code.google.com/p/go/source/detail?r=3e8c5af7bb1a810f148f938110778ae3a0204442 http://code.google.com/p/go/source/detail?r=3e8c5af7bb1a810f...). Pretty cool to see that Ken Thompson is still checking in code.
- pmjordan 16y agoInteresting that they completely ignore dynamic branching, but I guess the target audience are mostly classical "embedded" developers rather than mobile app devs. If you're writing iOS apps in Objective-C, you're paying a penalty for every method call, as it goes through the objc_msgSend() dispatch mechanism every time. I'm extremely surprised Apple haven't added more "clever" optimisations to the compiler, such as a JVM-like call site cache for de-facto monomorphic calls. (hacking clang/llvm to do that is an item on my endless list of things to do on a rainy day) This would essentially allow branch prediction and instruction prefetching on messages for a vast majority of cases. C++ virtual calls are typically cheaper than Objective-C messages but can also benefit from this sort of treatment (just not as much).
- dpt 16y agoI presented a course on this subject to engineers at my former employer. It's a set of tips about how to improve C code for ARM targets: http://www.davespace.co.uk/arm/efficient-c-for-arm/index.html http://www.davespace.co.uk/arm/efficient-c-for-arm/index.htm...