# Ensmallening Go binaries by prohibiting comparisons

DevFeed: [Ensmallening Go binaries by prohibiting comparisons](<https://devfeed.tech/articles/ensmallening-go-binaries-by-prohibiting-comparisons-20831.md>)

Original publisher: [Read original article](<https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons>)

Author: Dave Cheney

Published: 2020-05-09T10:23:17Z

Content type: article

Language: en

Sources: [Dave Cheney](<https://devfeed.tech/sources/dave-cheney.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [binaries](<https://devfeed.tech/tags/binaries.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [go](<https://devfeed.tech/tags/go.md>), [padding](<https://devfeed.tech/tags/padding.md>), [programming](<https://devfeed.tech/tags/programming.md>), [types](<https://devfeed.tech/tags/types.md>)

## AI overview

This article examines how equality and struct comparison work in Go, including memory layout, padding, alignment, and memcmp-based comparisons. It connects these implementation details to the size of compiled Go binaries.

## Source excerpt

Conventional wisdom dictates that the larger the number of types declared in a Go program, the larger the resulting binary. Intuitively this makes sense, after all, what's the point in defining a bunch of types if you're not going to write code that operates on them. However, part of the job of a linker is [...]