v icon indicating copy to clipboard operation
v copied to clipboard

Add `-prod-small` flag as alias for `-cflags -0s`

Open i582 opened this issue 1 year ago • 3 comments

Describe the feature

Right now, if a user wants a binary that is as small as possible, they need to know the C flags. I think that in order to use V, the user does not need to know all the flags of the C compilers.

It's also useful to be more abstract as this flag will work for other backends in the future.

This flag can be documented and explicitly visible to the user, unlike -cflags -0s which only experienced C developers will know.

Use Case

See above.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

Version used

0.3.3

Environment details (OS name and version, etc.)

macOS 13

i582 avatar Mar 01 '23 14:03 i582

This may be a premature optimization. V still needs to get the -skip-unused option finished so it becomes the default, before we start worrying about "as small as possible" (since it can't get a lot smaller until we stop including all of builtin on every build).

JalonSolov avatar Mar 01 '23 14:03 JalonSolov

This may be a premature optimization. V still needs to get the -skip-unused option finished so it becomes the default, before we start worrying about "as small as possible" (since it can't get a lot smaller until we stop including all of builtin on every build).

yeah, that's right, but it's just adding a flag, nothing more is needed. But with it, you can automatically enable additional flags in the future, if they appear. It's more of a vision for the future than for now.

i582 avatar Mar 01 '23 14:03 i582

Speaking of skip-unused.

I will be working on enabling skip-unused, use-cache, and parallel-cc by default this month.

medvednikov avatar Mar 01 '23 14:03 medvednikov