首页 > 其他分享 >[GO-LANG] Why is my trivial program such a large binary?

[GO-LANG] Why is my trivial program such a large binary?

时间:2024-03-31 12:44:05浏览次数:12  
标签:LANG binary my large program Go trivial

 

Why is my trivial program such a large binary?

The linker in the gc toolchain creates statically-linked binaries by default. All Go binaries therefore include the Go runtime, along with the run-time type information necessary to support dynamic type checks, reflection, and even panic-time stack traces.

A simple C "hello, world" program compiled and linked statically using gcc on Linux is around 750 kB, including an implementation of printf. An equivalent Go program using fmt.Printf weighs a couple of megabytes, but that includes more powerful run-time support and type and debugging information.

A Go program compiled with gc can be linked with the -ldflags=-w flag to disable DWARF generation, removing debugging information from the binary but with no other loss of functionality. This can reduce the binary size substantially.

 

来源:https://go.dev/doc/faq#Why_is_my_trivial_program_such_a_large_binary

 

参考:https://stackoverflow.com/questions/28576173/reason-for-huge-size-of-compiled-executable-of-go

 

标签:LANG,binary,my,large,program,Go,trivial
From: https://www.cnblogs.com/profesor/p/18106602

相关文章

  • GPT-1原理-Improving Language Understanding by Generative Pre-Training
    文章目录前言提出动机模型猜想模型提出模型结构模型参数模型预训练训练的目标训练方式训练参数预训练数据集预训练疑问点模型微调模型输入范式模型训练微调建议微调疑问点实验结果分析GPT-1缺陷前言首先想感慨一波这是当下最流行的大模型的的开篇之作,由OpenAI提......
  • 使用 wsl+makefile+clangd编辑stm32代码环境的搭建
    使用wsl+makefile+clangd编辑stm32代码环境的搭建安装wsl环境可以看看下面的文章安装与换源都提及,相信大家可以安装成功的https://www.cnblogs.com/banmei-brandy/p/16218660.html安装make、bear、clangd、arm-none-eabi-gcc、最新的构建库sudoaptinstallmakebearclang......
  • 【WEEK5】 【DAY5】DML Language【English Version】
    2024.3.29FridayContents3.DMLLanguage3.1.ForeignKeys(ForUnderstanding)3.1.1.Concept3.1.2.Purpose3.1.3.SeveralMethodstoAdd(Write)ForeignKeys3.1.3.1.CreatingtheTablewithDirectReferenceInside(thepartbeingreferencedoftherefe......
  • 【Clang+LLVM+honggfuzz学习】(一)LLVM简介、安装和第一个Hello Pass
    本文结构,PS:根据需要选择观看哦1.前言参考2.简介传统编译器架构LLVM架构3.LLVM安装版本准备官网源码下载git下载安装过程4.写一个LLVMPass旧HelloPass实现(legacyPMversion)新HelloPass实现(UsingtheNewPassManager)1.前言漏洞检测做毕设,还有一年。半......
  • golang: 分析查看汇编代码
    golang:分析查看汇编代码查看可执行文件可视化注意:linux用户需要额外运行goinstall--tagsnowaylandloov.dev/lensm@main​下载lensm:goinstallloov.dev/lensm@main运行lensm​:lensm.\main.exe​效果:​​Gobuild​gobuild-gcflags-S.\main.go​......
  • LangChain SQL介绍以及使用Qwen1.5执行SQL查询教程
    该模块可以让我们向LLM提问时从数据库中查询数据并做出回答。架构SQLchain和agent的高层抽象架构:问题转查询SQL:使用LLM将用户输入转成SQL查询执行SQL查询:执行SQL语句回答问题:LLM根据数据库查询结果返回回答内容环境安装安装必要环境和包pipinstall--upgrade--quiet......
  • golang学习路线
    golang学习路线学习Golang的路线可以分为以下几个阶段:基础语法:了解Golang的基本语法结构,包括变量声明、控制流、函数、指针等。数据类型:熟悉Golang的基本数据类型,如整型、浮点型、字符串、数组、切片、Map等。并发编程:学习Golang的并发编程特性,包括goroutines、channels和互斥......
  • A Systematic Survey of Prompt Engineering in Large Language Models: Techniques a
    本文是LLM系列文章,针对《ASystematicSurveyofPromptEngineeringinLargeLanguageModels:TechniquesandApplications》的翻译。大型语言模型中提示工程的系统综述:技术与应用摘要1引言2提示工程3结论摘要提示工程已经成为扩展大型语言模型(LLM)和视......
  • Large Language Models As Evolution Strategies
    本文是LLM系列文章,针对《LargeLanguageModelsAsEvolutionStrategies》的翻译。作为进化策略的大型语言模型摘要1引言2相关工作3背景4将LLMS转化为ES算法5LLMS作为零样本进化策略6EVOLLM消融研究7EVOLLM与教师微调8讨论摘要大型Transformer模......
  • golang 读取文件内容,清空文件内容,把读取的内容写入到文件里
    packagemainimport( "encoding/json" "fmt" "io" "log" "os")typePvRelationListstruct{ Item[]PvRelationInfo`json:"item"`}typePvRelationInfostruct{ PodNamestring`json:"p......