TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

HN: Help make Golang more (resource|env) friendly

1 点作者 codesniperjoe超过 2 年前

1 comment

codesniperjoe超过 2 年前
Hi, just discovered that the (sometimes excessive large) golang mod disk cache is - in opposite to the compiler cache - not (yet) properly deduplicated.<p>Try yourself: Made a little hack&#x2F;tool to deduplicate data via hardlinks (unix&#x2F;i-node-filesystems tested only, not windows yet).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;paepckehh&#x2F;fsdd">https:&#x2F;&#x2F;github.com&#x2F;paepckehh&#x2F;fsdd</a><p>(less than 1kLOC, 100% golang stdlib, no external deps)<p><pre><code> go install paepcke.de&#x2F;fsdd&#x2F;cmd&#x2F;fsdd@latest cd $GOMODCACHE &amp;&amp; fsdd --hard-link . FSDD [start] [&#x2F;usr&#x2F;store&#x2F;gomod][hash:MAPHASH] FSDD [_done] [time: 39.000221ms] FSDD [stats] [files:13329] [inode(s): 8680] [sym.valid: 0] [sym.invalid: 0] [data blocks: 277.1 Mbytes] FSDD [_info] [new deduplication savings][inode(s): 4649] [data blocks: 66.9 Mbytes] </code></pre> If you can reproduce and has it shows no downsides (remove&#x2F;add should auto-dereference) it should be part of src&#x2F;cmd&#x2F;go&#x2F;internal&#x2F;mod* pack?<p>If you can confirm&#x2F;field test, please report back! I would love to write a quick stdlib&#x2F;proposal.<p>At golang scale, it could make a real resource &#x2F; enviromental dent!<p>It least for me, it cut my disk cache in half and reduced vfs fs mem-cache required as well, so should scale even on deduplicated fs like zfs&#x2F;btrfs. Made my batch builds fast and snappy again!<p>Michael (edit:first-post-ever-style-fixes)