Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/end-to-end-test-init-optim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
COLUMNS: 110
MAX_RETRIES: 3
RETRY_DELAY: 5
EXPECTED_IMPROVEMENT_PCT: 300
EXPECTED_IMPROVEMENT_PCT: 30
CODEFLASH_END_TO_END: 1
steps:
- name: 🛎️ Checkout
Expand Down
5 changes: 5 additions & 0 deletions codeflash/api/aiservice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import json
import os
import platform
Expand Down Expand Up @@ -95,6 +97,7 @@ def optimize_python_code(
- List[OptimizationCandidate]: A list of Optimization Candidates.
"""
start_time = time.perf_counter()
payload = {
"source_code": source_code,
"dependency_code": dependency_code,
Expand All @@ -118,6 +121,8 @@ def optimize_python_code(
optimizations_json = response.json()["optimizations"]
logger.info(f"Generated {len(optimizations_json)} candidates.")
console.rule()
end_time = time.perf_counter()
logger.debug(f"Optimization took {end_time - start_time:.2f} seconds.")
return [
OptimizedCandidate(
source_code=opt["source_code"],
Expand Down
5 changes: 5 additions & 0 deletions codeflash/verification/concolic_testing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import ast
import subprocess
import tempfile
Expand All @@ -20,6 +22,7 @@
def generate_concolic_tests(
test_cfg: TestConfig, args: Namespace, function_to_optimize: FunctionToOptimize, function_to_optimize_ast: ast.AST
) -> tuple[dict[str, list[FunctionCalledInTest]], str]:
start_time = time.perf_counter()
function_to_concolic_tests = {}
concolic_test_suite_code = ""
if (
Expand Down Expand Up @@ -84,4 +87,6 @@ def generate_concolic_tests(
else:
logger.debug(f"Error running CrossHair Cover {': ' + cover_result.stderr if cover_result.stderr else '.'}")
console.rule()
end_time = time.perf_counter()
logger.debug(f"Generated concolic tests in {end_time - start_time:.2f} seconds")
return function_to_concolic_tests, concolic_test_suite_code
6 changes: 5 additions & 1 deletion codeflash/verification/verifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import ast
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -29,6 +31,7 @@ def generate_tests(
) -> tuple[str, str, Path] | None:
# TODO: Sometimes this recreates the original Class definition. This overrides and messes up the original
# class import. Remove the recreation of the class definition
start_time = time.perf_counter()
test_module_path = Path(module_name_from_file_path(test_path, test_cfg.tests_project_rootdir))
response = aiservice_client.generate_regression_tests(
source_code_being_tested=source_code_being_tested,
Expand All @@ -54,7 +57,8 @@ def generate_tests(
else:
logger.warning(f"Failed to generate and instrument tests for {function_to_optimize.function_name}")
return None

end_time = time.perf_counter()
logger.debug(f"Generated tests in {end_time - start_time:.2f} seconds")
return (
generated_test_source,
instrumented_behavior_test_source,
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/end_to_end_test_init_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def run_test(expected_improvement_pct: int) -> bool:
file_path="remove_control_chars.py",
function_name="CharacterRemover.remove_control_characters",
test_framework="pytest",
min_improvement_x=1.0,
min_improvement_x=0.3,
coverage_expectations=[
CoverageExpectation(
function_name="CharacterRemover.remove_control_characters", expected_coverage=100.0, expected_lines=[14]
Expand Down
Loading