On Wed, Oct 27, 2021 at 3:34 PM
jlfo...@berkeley.edu
<
jlfo...@berkeley.edu> wrote:
>
> I'm asking because preinitializing an executable binary, where possible, seems like an obvious optimization.
> I'm writing baby programs as I'm learning Go, but even they have a significant (to me) number of initializations
> that don't need to take up any execution time. On the other hand, modern computers are so fast maybe it's not
> even worth paying attention to such things.
>
> I'm not an expert but I don't think the example you showed says anything about preinitialized data. For example,
> I built the following trivial program:
>
> package main
>
> var x = []int {1,2,3,4,5,6,7,8}
> var s string = "abcdefg"
> var p float64 = 3.1415
>
> func main() {
> }
>
> and then ran nm on the executable. I didn't see any sign of any of the constants in my program. But,
> maybe I don't know what to look for. Your example shows data, but not initialized data. Please
> correct me.
Try a program where the constants are actually used. For example,