tags:

views:

586

answers:

3

I'm considering using Go as a low-level, performant language alternative to C/Objective-C to implement a library for an iPhone App. Could either of the Go compilers generate a library that could be linked into a native iPhone app with the Go runtime, etc.? Is there an ARM port for Go or does gccgo/gcc support this? I imagine that since gccgo uses gcc as the back-end and Xcode uses gcc to compile iPhone apps that there is a strong chance that this is possible. If it's possible, how would I set that up in an Xcode project?

Has anyone tried this or seen it discussed before? (When I do a Google search like "compiling go code iphone" the "go" part is completely unused and I get only stuff about iPhone development.)

+2  A: 

Go doesn't support the iphone platform right now, but it does support ARM processors. There hasn't been much discussion about this on the mailing list though.

marketer
+2  A: 

Even if possible, I suspect Go is significantly slower than C or Objective C. Most independent benchmarks seem to suggest poor performance using the current development versions. These microbenchmarks against C suggest Go is 2 to 150 times slower than C. It is even slower than Java and C# Mono. So I see little reason to call Go a performant alternative.

Although it depends on your application, I suspect leveraging the GPU api is the best bet for most performance problems.

Tristan
So Go is targeting replacing C#/Java on the server? Is that sort of the idea? I guess C will do what I need, but I could use the strings, hashtables, etc.
Jared Updike
Is interesting also to look at the code size column 150X but 624 (Go) vs 2579 (C). You develop faster and in the time your application becomes successful also the compiler could have improved.
fabrizioM
igouy
>> These microbenchmarks << Are for the 6g Go compiler and runtime, but the OP was talking about gccgo
igouy
+1  A: 

One thing to at least look at would be Lua. It is fast and is a language I like using. iPhone Wax uses lua.

Jon Steinmetz
I just read the reference manual this week! What I'm actually implementing is a scripting language and the Lua C sources could be useful although implementing a scripting language in another scripting language would probably be a bad idea. (My prototype for the scripting language is in Haskell and I was looking for an adequate substitute. I will probably have to make due with C.
Jared Updike