@@ -18,7 +18,6 @@ use relay_docblock::extend_schema_with_resolver_type_system_definition;
1818use relay_docblock:: validate_resolver_schema;
1919use schema:: SDLSchema ;
2020use schema:: SchemaDocuments ;
21- use schema:: build_schema_with_flat_buffer_unchecked;
2221use schema:: parse_schema_with_extensions;
2322use schema_validate_lib:: SchemaValidationOptions ;
2423use schema_validate_lib:: validate;
@@ -62,32 +61,30 @@ fn build_schema_impl(
6261 config : & Config ,
6362 graphql_asts_map : & FnvHashMap < ProjectName , GraphQLAsts > ,
6463) -> DiagnosticsResult < Arc < SDLSchema > > {
65- if let SchemaLocation :: FlatbufferFile ( fb_path) = & project_config. schema_location {
66- // Load flatbuffer (has base schema + SDL extensions, but NOT docblock IRs)
67- let mut schema = if let Some ( fb_sources) =
68- compiler_state. flatbuffer_schemas . get ( & project_config. name )
69- && let Some ( bytes) = fb_sources. get_current_bytes ( )
64+ if let SchemaLocation :: CompactFile ( compact_path) = & project_config. schema_location {
65+ // Load compact schema (has base schema + SDL extensions, but NOT docblock IRs).
66+ // Compact format deserializes directly into InMemorySchema with parallel decoding.
67+ let owned_bytes;
68+ let compact_bytes: & [ u8 ] = if let Some ( compact_sources) =
69+ compiler_state. compact_schemas . get ( & project_config. name )
70+ && let Some ( bytes) = compact_sources. get_current_bytes ( )
7071 {
71- build_schema_with_flat_buffer_unchecked ( bytes. clone ( ) )
72+ bytes
7273 } else {
73- let contents = std:: fs:: read ( config. root_dir . join ( fb_path ) )
74+ owned_bytes = std:: fs:: read ( config. root_dir . join ( compact_path ) )
7475 . map_err ( |e| vec ! [ Diagnostic :: error( e. to_string( ) , Location :: generated( ) ) ] ) ?;
75- build_schema_with_flat_buffer_unchecked ( contents )
76+ & owned_bytes
7677 } ;
78+ let mut schema = log_event. time ( "deserialize_compact_schema_time" , || {
79+ SDLSchema :: InMemory ( schema:: compact:: deserialize_parallel ( compact_bytes) )
80+ } ) ;
7781
7882 // Extract docblock IRs
7983 let resolver_schema_data = log_event. time ( "collect_resolver_schema_time" , || {
8084 extract_docblock_ir ( config, compiler_state, project_config, graphql_asts_map)
8185 } ) ?;
8286
83- // Apply type IRs as mutations (since they can't be baked into the flatbuffer).
84- //
85- // Unlike the non-FB path (InMemorySchema::build), which does a two-pass
86- // batch build (collect all type names, then resolve all field references),
87- // here we apply each resolver type definition one-by-one. This works because
88- // resolver types typically only reference existing base-schema types that are
89- // already present in the flatbuffer. If cross-resolver-type references become
90- // necessary, this will need to be converted to a two-pass approach.
87+ // Apply type IRs as mutations
9188 log_event. time (
9289 "build_resolver_types_schema_time" ,
9390 || -> DiagnosticsResult < ( ) > {
0 commit comments