-
Notifications
You must be signed in to change notification settings - Fork 0
engine: rename pageindex→treewalk + auto strategy default (HAL-106) #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
25874e9
610b265
dd6697b
45edc12
ab1c669
7407704
b5807b5
18b5c1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,7 @@ func main() { | |
| ID string `json:"id"` | ||
| } `json:"sections"` | ||
| } | ||
| json.Unmarshal(treeResp, &treeData) | ||
| _ = json.Unmarshal(treeResp, &treeData) // benchmark best-effort parse | ||
| sectionID := "" | ||
| if len(treeData.Sections) > 1 { | ||
| sectionID = treeData.Sections[1].ID // pick a child section | ||
|
|
@@ -87,9 +87,9 @@ func main() { | |
| fmt.Printf("Using section ID: %s\n\n", sectionID) | ||
|
|
||
| type result struct { | ||
| name string | ||
| rest []time.Duration | ||
| grpc []time.Duration | ||
| name string | ||
| rest []time.Duration | ||
| grpc []time.Duration | ||
| } | ||
|
|
||
| var results []result | ||
|
|
@@ -101,12 +101,12 @@ func main() { | |
| fmt.Print(".") | ||
| // REST | ||
| start := time.Now() | ||
| restGET(base + "/v1/health") | ||
| _, _ = restGET(base + "/v1/health") | ||
| r.rest = append(r.rest, time.Since(start)) | ||
|
|
||
| // gRPC (Connect) | ||
| start = time.Now() | ||
| healthClient.Check(ctx, connect.NewRequest(&v1.HealthCheckRequest{})) | ||
| _, _ = healthClient.Check(ctx, connect.NewRequest(&v1.HealthCheckRequest{})) | ||
| r.grpc = append(r.grpc, time.Since(start)) | ||
|
Comment on lines
+104
to
110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t include failed calls in latency samples. All benchmark paths discard request errors, so network/protocol failures are still timed and recorded as “successful” latency. This skews median/p95 and can invert REST vs gRPC conclusions. Track failures separately and only append durations for successful calls (or report success-rate alongside latency). Also applies to: 121-126, 137-144, 156-163, 185-194 🤖 Prompt for AI Agents |
||
| } | ||
| fmt.Println(" done") | ||
|
|
@@ -118,11 +118,11 @@ func main() { | |
| for i := 0; i < n; i++ { | ||
| fmt.Print(".") | ||
| start := time.Now() | ||
| restGET(base + "/v1/documents") | ||
| _, _ = restGET(base + "/v1/documents") | ||
| r.rest = append(r.rest, time.Since(start)) | ||
|
|
||
| start = time.Now() | ||
| docsClient.ListDocuments(ctx, connect.NewRequest(&v1.ListDocumentsRequest{Limit: 10})) | ||
| _, _ = docsClient.ListDocuments(ctx, connect.NewRequest(&v1.ListDocumentsRequest{Limit: 10})) | ||
| r.grpc = append(r.grpc, time.Since(start)) | ||
| } | ||
| fmt.Println(" done") | ||
|
|
@@ -134,11 +134,11 @@ func main() { | |
| for i := 0; i < n; i++ { | ||
| fmt.Print(".") | ||
| start := time.Now() | ||
| restGET(base + "/v1/documents/" + *docID + "/tree") | ||
| _, _ = restGET(base + "/v1/documents/" + *docID + "/tree") | ||
| r.rest = append(r.rest, time.Since(start)) | ||
|
|
||
| start = time.Now() | ||
| docsClient.GetDocumentTree(ctx, connect.NewRequest(&v1.GetDocumentTreeRequest{ | ||
| _, _ = docsClient.GetDocumentTree(ctx, connect.NewRequest(&v1.GetDocumentTreeRequest{ | ||
| DocumentId: *docID, | ||
| })) | ||
| r.grpc = append(r.grpc, time.Since(start)) | ||
|
|
@@ -153,11 +153,11 @@ func main() { | |
| for i := 0; i < n; i++ { | ||
| fmt.Print(".") | ||
| start := time.Now() | ||
| restGET(base + "/v1/sections/" + sectionID) | ||
| _, _ = restGET(base + "/v1/sections/" + sectionID) | ||
| r.rest = append(r.rest, time.Since(start)) | ||
|
|
||
| start = time.Now() | ||
| docsClient.GetSection(ctx, connect.NewRequest(&v1.GetSectionRequest{ | ||
| _, _ = docsClient.GetSection(ctx, connect.NewRequest(&v1.GetSectionRequest{ | ||
| SectionId: sectionID, | ||
| })) | ||
| r.grpc = append(r.grpc, time.Since(start)) | ||
|
|
@@ -182,12 +182,12 @@ func main() { | |
| "query": q, | ||
| }) | ||
| start := time.Now() | ||
| restPOST(base+"/v1/query", body) | ||
| _, _ = restPOST(base+"/v1/query", body) | ||
| r.rest = append(r.rest, time.Since(start)) | ||
|
|
||
| // gRPC (Connect) | ||
| start = time.Now() | ||
| queryClient.Query(ctx, connect.NewRequest(&v1.QueryRequest{ | ||
| _, _ = queryClient.Query(ctx, connect.NewRequest(&v1.QueryRequest{ | ||
| DocumentId: *docID, | ||
| Query: q, | ||
| })) | ||
|
|
@@ -246,7 +246,7 @@ func restGET(url string) ([]byte, error) { | |
| if err != nil { | ||
| return nil, err | ||
| } | ||
| defer resp.Body.Close() | ||
| defer func() { _ = resp.Body.Close() }() // best-effort close | ||
| return io.ReadAll(resp.Body) | ||
| } | ||
|
|
||
|
|
@@ -255,7 +255,7 @@ func restPOST(url string, body []byte) ([]byte, error) { | |
| if err != nil { | ||
| return nil, err | ||
| } | ||
| defer resp.Body.Close() | ||
| defer func() { _ = resp.Body.Close() }() // best-effort close | ||
| return io.ReadAll(resp.Body) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle tree parse failure explicitly before section benchmark selection.
If
json.Unmarshalfails,sectionIDremains empty and “Get Section” benchmarking is silently skipped. Log/track this as a failed setup step so results aren’t misread as complete.🤖 Prompt for AI Agents