Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
692bc52
feat: implement JIT benchmarking suite and comparison logic
Kesavaraja67 Jan 15, 2026
67223d4
Merge remote-tracking branch 'upstream/main' into feat/jit-benchmarking
Kesavaraja67 Jan 15, 2026
8a610fe
refactor: address AI review feedback and improve benchmark robustness
Kesavaraja67 Jan 15, 2026
2ca71bc
Merge branch 'main' into feat/jit-benchmarking
Kesavaraja67 Jan 15, 2026
4cdadfa
chore: Added Documentation
Kesavaraja67 Jan 15, 2026
7c0b580
Merge remote-tracking branch 'upstream/main' into feat/jit-benchmarking
Kesavaraja67 Jan 15, 2026
7196d14
docs: add JIT benchmarking documentation and update main README
Kesavaraja67 Jan 15, 2026
8f13d0c
docs: complete jit-benchmark documentation per gemini-code-assist fee…
Kesavaraja67 Jan 15, 2026
f5ca5c7
Merge branch 'main' into feat/jit-benchmarking
Anshgrover23 Jan 15, 2026
dacce6d
Merge remote-tracking branch 'upstream/main' into feat/jit-benchmarking
Kesavaraja67 Jan 16, 2026
0cce973
Merge branch 'main' into feat/jit-benchmarking
Kesavaraja67 Jan 16, 2026
8a931c8
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 16, 2026
bcb92f6
chore: sync upstream fixes and documentation updates
Kesavaraja67 Jan 16, 2026
3cea92f
Merge branch 'feat/jit-benchmarking' of https://github.com/Kesavaraja…
Kesavaraja67 Jan 16, 2026
b726294
Merge branch 'main' into feat/jit-benchmarking
Anshgrover23 Jan 16, 2026
e0a636d
Merge remote-tracking branch 'upstream/main' into feat/jit-benchmarking
Kesavaraja67 Jan 16, 2026
2d4dbac
Merge branch 'feat/jit-benchmarking' of https://github.com/Kesavaraja…
Kesavaraja67 Jan 16, 2026
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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cortex install "tools for video compression"
| **Full Rollback** | Undo any installation with `cortex rollback` |
| **Role Management** | AI-driven system personality detection and tailored recommendations |
| **Docker Permission Fixer** | Fix root-owned bind mount issues automatically |
| **JIT Benchmarking** | Measure Python 3.13 performance gains for Cortex operations |
| **Audit Trail** | Complete history in `~/.cortex/history.db` |
| **Hardware-Aware** | Detects GPU, CPU, memory for optimized packages |
| **Multi-LLM Support** | Works with Claude, GPT-4, or local Ollama models |
Expand Down Expand Up @@ -177,6 +178,22 @@ cortex role detect
cortex role set <slug>
```

### JIT Benchmarking (Python 3.13+)

Measure the speed impact of Python's new JIT compiler on Cortex:

```bash
# Check status and list tests
cortex jit-benchmark info
cortex jit-benchmark list

# Run with custom iterations and export
cortex jit-benchmark run --iterations 50 --output results.json

# Compare results
cortex jit-benchmark compare --baseline base.json --jit enabled.json
```

### Command Reference

| Command | Description |
Expand All @@ -187,6 +204,7 @@ cortex role set <slug>
| `cortex docker permissions` | Fix file ownership for Docker bind mounts |
| `cortex role detect` | Automatically identifies the system's purpose |
| `cortex role set <slug>` | Manually declare a system role |
| `cortex jit-benchmark <subcommand>` | Run, compare, and analyze Python 3.13+ JIT performance benchmarks |
| `cortex sandbox <cmd>` | Test packages in Docker sandbox |
| `cortex history` | View all past installations |
| `cortex rollback <id>` | Undo a specific installation |
Expand Down Expand Up @@ -378,6 +396,7 @@ pip install -e .
- [x] Dry-run preview mode
- [x] Docker bind-mount permission fixer
- [x] Automatic Role Discovery (AI-driven system context sensing)
- [x] Python JIT Benchmarking Suite (Performance analysis)

### In Progress
- [ ] Conflict resolution UI
Expand Down
61 changes: 61 additions & 0 deletions cortex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
)
from cortex.env_manager import EnvironmentManager, get_env_manager
from cortex.installation_history import InstallationHistory, InstallationStatus, InstallationType
from cortex.jit_benchmark import run_jit_benchmark
from cortex.llm.interpreter import CommandInterpreter
from cortex.network_config import NetworkConfig
from cortex.notification_manager import NotificationManager
Expand Down Expand Up @@ -780,6 +781,30 @@ def _sandbox_exec(self, sandbox, args: argparse.Namespace) -> int:

# --- End Sandbox Commands ---

def jit_benchmark(self, args: argparse.Namespace) -> int:
"""Handle JIT benchmarking commands.

Args:
args: Parsed command-line arguments.

Returns:
Exit code (0 for success, 1 for error).
"""
action = getattr(args, "bench_action", "run")
benchmark_name = getattr(args, "benchmark", None)
iterations = getattr(args, "iterations", 100)
output = getattr(args, "output", None)

# Handle compare action
if action == "compare":
baseline = getattr(args, "baseline", None)
jit = getattr(args, "jit", None)
return run_jit_benchmark(action="compare", compare_baseline=baseline, compare_jit=jit)

return run_jit_benchmark(
action=action, benchmark_name=benchmark_name, iterations=iterations, output=output
)

def ask(self, question: str) -> int:
"""Answer a natural language question about the system."""
api_key = self._get_api_key()
Expand Down Expand Up @@ -2865,6 +2890,7 @@ def show_rich_help():
table.add_row("env", "Manage environment variables")
table.add_row("cache stats", "Show LLM cache statistics")
table.add_row("docker permissions", "Fix Docker bind-mount permissions")
table.add_row("jit-benchmark", "Python JIT performance benchmarks")
table.add_row("sandbox <cmd>", "Test packages in Docker sandbox")
table.add_row("update", "Check for and install updates")

Expand Down Expand Up @@ -2950,6 +2976,36 @@ def main():
docker_parser = subparsers.add_parser("docker", help="Docker and container utilities")
docker_subs = docker_parser.add_subparsers(dest="docker_action", help="Docker actions")

# JIT Benchmark command
jit_parser = subparsers.add_parser(
"jit-benchmark", help="Benchmark Python JIT compilation performance"
)
jit_subs = jit_parser.add_subparsers(dest="bench_action", help="Benchmark actions")

# jit-benchmark run (default action)
jit_run_parser = jit_subs.add_parser("run", help="Run benchmarks")
jit_run_parser.add_argument(
"-b",
"--benchmark",
choices=["cli", "parse", "cache", "stream"],
help="Specific benchmark to run (default: all)",
)
jit_run_parser.add_argument(
"-i", "--iterations", type=int, default=100, help="Number of iterations (default: 100)"
)
jit_run_parser.add_argument("-o", "--output", help="Export results to JSON file")

# jit-benchmark list
jit_subs.add_parser("list", help="List available benchmarks")

# jit-benchmark info
jit_subs.add_parser("info", help="Show JIT status and information")

# jit-benchmark compare
jit_compare_parser = jit_subs.add_parser("compare", help="Compare baseline vs JIT results")
jit_compare_parser.add_argument("--baseline", required=True, help="Baseline results JSON file")
jit_compare_parser.add_argument("--jit", required=True, help="JIT results JSON file")

# Add the permissions action to allow fixing file ownership issues
perm_parser = docker_subs.add_parser(
"permissions", help="Fix file permissions from bind mounts"
Expand Down Expand Up @@ -3597,6 +3653,11 @@ def main():
dry_run=args.dry_run,
parallel=args.parallel,
)
elif args.command == "jit-benchmark":
# Set default action if no subcommand
if not hasattr(args, "bench_action") or args.bench_action is None:
args.bench_action = "run"
return cli.jit_benchmark(args)
elif args.command == "remove":
# Handle --execute flag to override default dry-run
if args.execute:
Expand Down
Loading
Loading