@@ -5,10 +5,11 @@ use red_knot::workspace::WorkspaceMetadata;
5
5
use ruff_benchmark:: criterion:: {
6
6
criterion_group, criterion_main, BatchSize , Criterion , Throughput ,
7
7
} ;
8
- use ruff_db:: files:: { system_path_to_file, File } ;
8
+ use ruff_db:: files:: { system_path_to_file, vendored_path_to_file , File } ;
9
9
use ruff_db:: parsed:: parsed_module;
10
10
use ruff_db:: program:: { ProgramSettings , SearchPathSettings , TargetVersion } ;
11
11
use ruff_db:: system:: { MemoryFileSystem , SystemPath , TestSystem } ;
12
+ use ruff_db:: vendored:: VendoredPath ;
12
13
use ruff_db:: Upcast ;
13
14
14
15
static FOO_CODE : & str = r#"
@@ -48,6 +49,7 @@ struct Case {
48
49
foo : File ,
49
50
bar : File ,
50
51
typing : File ,
52
+ builtins : File ,
51
53
}
52
54
53
55
fn setup_case ( ) -> Case {
@@ -56,6 +58,7 @@ fn setup_case() -> Case {
56
58
let foo_path = SystemPath :: new ( "/src/foo.py" ) ;
57
59
let bar_path = SystemPath :: new ( "/src/bar.py" ) ;
58
60
let typing_path = SystemPath :: new ( "/src/typing.pyi" ) ;
61
+ let builtins_path = VendoredPath :: new ( "stdlib/builtins.pyi" ) ;
59
62
fs. write_files ( [
60
63
( foo_path, FOO_CODE ) ,
61
64
( bar_path, BAR_CODE ) ,
@@ -82,13 +85,15 @@ fn setup_case() -> Case {
82
85
83
86
let bar = system_path_to_file ( & db, bar_path) . unwrap ( ) ;
84
87
let typing = system_path_to_file ( & db, typing_path) . unwrap ( ) ;
88
+ let builtins = vendored_path_to_file ( & db, builtins_path) . unwrap ( ) ;
85
89
86
90
Case {
87
91
db,
88
92
fs,
89
93
foo,
90
94
bar,
91
95
typing,
96
+ builtins,
92
97
}
93
98
}
94
99
@@ -104,6 +109,7 @@ fn benchmark_without_parse(criterion: &mut Criterion) {
104
109
parsed_module ( case. db . upcast ( ) , case. foo ) ;
105
110
parsed_module ( case. db . upcast ( ) , case. bar ) ;
106
111
parsed_module ( case. db . upcast ( ) , case. typing ) ;
112
+ parsed_module ( case. db . upcast ( ) , case. builtins ) ;
107
113
case
108
114
} ,
109
115
|case| {
@@ -172,7 +178,7 @@ fn benchmark_cold(criterion: &mut Criterion) {
172
178
group. finish ( ) ;
173
179
}
174
180
175
- criterion_group ! ( cold, benchmark_without_parse ) ;
176
- criterion_group ! ( without_parse, benchmark_cold ) ;
181
+ criterion_group ! ( cold, benchmark_cold ) ;
182
+ criterion_group ! ( without_parse, benchmark_without_parse ) ;
177
183
criterion_group ! ( incremental, benchmark_incremental) ;
178
184
criterion_main ! ( without_parse, cold, incremental) ;
0 commit comments