4 ms·
I don't think it's necessarily tailored to backend development. Go does have cheap threads, which is helpful for programming servers that handle many connection
by rough-sea 11y ago
I don't think it's necessarily tailored to backend development. Go does have cheap threads, which is helpful for programming servers that handle many connections - but that won't hinder you developing a GUI.
- pcwalton 11y agoDoesn't it mean that you have to use LockOSThread() for your main thread in order to avoid messing up the Android event loop, negating the advantages of cheap threads and forcing you to eat context switches when calling into Java land?
- rough-sea 11y agoNo, the main go thread will receive events on a channel, all GUI calls can be wrapped channel writes, which get sent to the Android thread. Like how React Native is modeled.
- pcwalton 11y agoIn that case you're paying the cost of even more context switches. One to get into the UI thread and one to get out, in the case of a synchronous call. In a LockOSThread solution you don't need any context switches. You also save the memory cost of one goroutine (which is admittedly small).