MCPcopy Index your code
hub / github.com/php/frankenphp / BenchmarkHelloWorld

Function BenchmarkHelloWorld

frankenphp_test.go:835–856  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

833}
834
835func BenchmarkHelloWorld(b *testing.B) {
836 require.NoError(b, frankenphp.Init())
837 b.Cleanup(frankenphp.Shutdown)
838
839 cwd, _ := os.Getwd()
840 testDataDir := cwd + "/testdata/"
841
842 opt := frankenphp.WithRequestDocumentRoot(testDataDir, false)
843 handler := func(w http.ResponseWriter, r *http.Request) {
844 req, err := frankenphp.NewRequestWithContext(r, opt)
845 require.NoError(b, err)
846
847 require.NoError(b, frankenphp.ServeHTTP(w, req))
848 }
849
850 req := httptest.NewRequest("GET", "http://example.com/index.php", nil)
851 w := httptest.NewRecorder()
852
853 for b.Loop() {
854 handler(w, req)
855 }
856}
857
858func BenchmarkEcho(b *testing.B) {
859 require.NoError(b, frankenphp.Init())

Callers

nothing calls this directly

Calls 4

InitFunction · 0.92
WithRequestDocumentRootFunction · 0.92
NewRequestWithContextFunction · 0.92
ServeHTTPFunction · 0.92

Tested by

no test coverage detected