Removing the function names and file information probably constitutes the
most part of the size, I would guess.

Do you suggest stripping it as a post processing step or modifying the 
linker
to not emit the strings in the first place?
I'm not fond of adding a new flag to the linker, but it may not be such a 
bad
idea in a mobile context to remove function names and file information.

I would assume most of that happens in cmd/link/internal/ld/pcln.go right ?

Thanks!

On Friday, April 5, 2019 at 12:14:49 AM UTC+2, Ian Lance Taylor wrote:
>
> On Thu, Apr 4, 2019 at 2:32 PM Steeve Morin <steev...@gmail.com 
> <javascript:>> wrote: 
> > 
> > We are big Go users on Android and iOS thanks to golang/mobile. 
> > 
> > Lately we were doing some size profiling and stumbled upon 
> runtime.pclntab, 
> > which in our case represents almost 20% of the file size according to 
> bloaty. 
> > Now I understand that it's used for things like runtime.Caller and 
> panics. 
> > That said, in a mobile context panics are not that useful as this job is 
> handled by 
> > services like Crashlytics and DWARF. 
> > 
> > So we were wondering if it would be possible to strip it (or not emit it 
> altogether) 
> > and what would be the consequences/limitations of that? 
>
> The consequences of removing pclntab would be fairly severe.  You 
> wouldn't just lose runtime.Callers and stack traces and tracing and 
> profiling.  The pclntab section is also used by the garbage collector 
> to traverse the stack, and by the stack copying code.  I doubt that 
> many substantial Go programs would still work correctly. 
>
> That said you could in principle drop part of pclntab with less severe 
> consequences, such as removing the function names.  I don't know of 
> any supported way to do that, though. 
>
> Ian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to