logoalt Hacker News

moron4hiretoday at 2:20 AM1 replyview on HN

If you have such a test suite then you really don't need AI to write the code for you.


Replies

thorian1828i03today at 2:30 AM

Writing a benchmark test is about 100x to 1000x easier than writing optimizations. A benchmark test can be as simple as:

    func Benchmark(b *testing.B) {
      for range b.N {
        runCodeUnderBenchmark()
      }
    }
Actually optimizing the runCodeUnderBenchmark() function is far more difficult.