<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>IzumiSy</author_name>
  <author_url>https://blog.hatena.ne.jp/IzumiSy/</author_url>
  <blog_title>Runner in the High</blog_title>
  <blog_url>https://izumisy.work/</blog_url>
  <categories>
    <anon>Golang</anon>
    <anon>メモ</anon>
    <anon>プログラミング</anon>
  </categories>
  <description>goコンパイラの最適化によって、可変長配列であってもリテラル値でlength指定されていればコンパイルする時点で確保するデータサイズが決定し結果的にランタイム時にアロケーションを発生させなくなるのではないかという仮説。 テストコード package app import ( &quot;bytes&quot; &quot;testing&quot; ) const ALLOC_SIZE = 64 * 1024 func BenchmarkFunc1(b *testing.B) { for i := 0; i &lt; b.N; i++ { v := make([]byte, ALLOC_SIZE) fill(v, '1', 0, ALLO…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fizumisy.work%2Fentry%2F2021%2F07%2F19%2F190945&quot; title=&quot;リテラル値でmakeしたらヒープに乗らなくてアロケーションの回数は少なくなるんじゃないか？という実験 - Runner in the High&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-07-19 19:09:45</published>
  <title>リテラル値でmakeしたらヒープに乗らなくてアロケーションの回数は少なくなるんじゃないか？という実験</title>
  <type>rich</type>
  <url>https://izumisy.work/entry/2021/07/19/190945</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
