Advanced Go (Golang)
Q98 / 100

What is the impact of interfaces on Go performance (interface boxing)?

Correct! Well done.

Incorrect.

The correct answer is B) Storing a value in an interface allocates a two-word pair (type pointer + data pointer/value); small values inline but larger ones heap-allocate (interface boxing)

B

Correct Answer

Storing a value in an interface allocates a two-word pair (type pointer + data pointer/value); small values inline but larger ones heap-allocate (interface boxing)

Explanation

An interface value is two words: *type and *data. For small scalars, data is stored directly. For pointers and larger types, it points to heap. Avoid interfaces in hot paths.

Progress
98/100