()
| 424 | } |
| 425 | |
| 426 | func extractAllCostTracker() interpreter.FunctionTracker { |
| 427 | return func(args []ref.Val, result ref.Val) *uint64 { |
| 428 | targetCost := float64(actualSize(args[0])+1) * common.StringTraversalCostFactor |
| 429 | regexCost := float64(actualSize(args[1])+1) * common.RegexStringLengthCostFactor |
| 430 | // Actual search cost calculation = targetCost + regexCost |
| 431 | searchCost := targetCost * regexCost |
| 432 | // The total cost is the base call cost + search cost + result allocation + list creation cost factor. |
| 433 | totalCost := float64(callCost) + searchCost + float64(actualSize(result)) + common.ListCreateBaseCost |
| 434 | // Round up and convert to uint64 for the final cost. |
| 435 | finalCost := uint64(math.Ceil(totalCost)) |
| 436 | return &finalCost |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | func replaceCostTracker() interpreter.FunctionTracker { |
| 441 | return func(args []ref.Val, result ref.Val) *uint64 { |
no test coverage detected