<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>methane</author_name>
  <author_url>https://blog.hatena.ne.jp/methane/</author_url>
  <blog_title>methaneのブログ</blog_title>
  <blog_url>https://methane.hatenablog.jp/</blog_url>
  <categories>
    <anon>golang</anon>
  </categories>
  <description>Benchmark関数を書くとき、重い初期化処理が必要になるケースがある。 例えばデータベースから大量のデータを読み込むベンチマークを書きたい場合、まずはその大きいデータを持ったテーブルを作る必要がある。 Goのベンチマーク関数は、普通は実行時間がターゲット（デフォルトで1秒）に近づくように b.N を変えながら複数回呼び出される。 func BenchmarkBigData(b *testing.B) { // 複数回呼び出される // 重いセットアップ b.ResetTimer() for range b.N { // 測りたいコード } b.StopTimer() // クリーンアップ …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmethane.hatenablog.jp%2Fentry%2F2025%2F04%2F23%2F155348&quot; title=&quot;Go 1.24 の testing.B.Loop() が便利 - methaneのブログ&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>2025-04-23 15:53:48</published>
  <title>Go 1.24 の testing.B.Loop() が便利</title>
  <type>rich</type>
  <url>https://methane.hatenablog.jp/entry/2025/04/23/155348</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
