mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
use cached subs, run solve tests single-threaded
This commit is contained in:
parent
78735b6159
commit
2cb175df10
2 changed files with 35 additions and 12 deletions
|
@ -32,6 +32,28 @@ fn load<'a>(
|
|||
)
|
||||
}
|
||||
|
||||
/// Load using only a single thread; used when compiling to webassembly
|
||||
pub fn load_single_threaded<'a>(
|
||||
arena: &'a Bump,
|
||||
load_start: LoadStart<'a>,
|
||||
src_dir: &Path,
|
||||
exposed_types: ExposedByModule,
|
||||
goal_phase: Phase,
|
||||
target_info: TargetInfo,
|
||||
) -> Result<LoadResult<'a>, LoadingProblem<'a>> {
|
||||
let cached_subs = read_cached_subs();
|
||||
|
||||
roc_load_internal::file::load_single_threaded(
|
||||
arena,
|
||||
load_start,
|
||||
src_dir,
|
||||
exposed_types,
|
||||
goal_phase,
|
||||
target_info,
|
||||
cached_subs,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn load_and_monomorphize_from_str<'a>(
|
||||
arena: &'a Bump,
|
||||
filename: PathBuf,
|
||||
|
@ -117,7 +139,10 @@ pub fn load_and_typecheck_str<'a>(
|
|||
|
||||
let load_start = LoadStart::from_str(arena, filename, source)?;
|
||||
|
||||
match load(
|
||||
// NOTE: this function is meant for tests, and so we use single-threaded
|
||||
// solving so we don't use too many threads per-test. That gives higher
|
||||
// throughput for the test run overall
|
||||
match load_single_threaded(
|
||||
arena,
|
||||
load_start,
|
||||
src_dir,
|
||||
|
@ -148,7 +173,6 @@ fn deserialize_help(bytes: &[u8]) -> (Subs, Vec<(Symbol, Variable)>) {
|
|||
fn read_cached_subs() -> MutMap<ModuleId, (Subs, Vec<(Symbol, Variable)>)> {
|
||||
let mut output = MutMap::default();
|
||||
|
||||
if false {
|
||||
output.insert(ModuleId::BOOL, deserialize_help(BOOL));
|
||||
output.insert(ModuleId::RESULT, deserialize_help(RESULT));
|
||||
output.insert(ModuleId::LIST, deserialize_help(LIST));
|
||||
|
@ -157,7 +181,6 @@ fn read_cached_subs() -> MutMap<ModuleId, (Subs, Vec<(Symbol, Variable)>)> {
|
|||
output.insert(ModuleId::SET, deserialize_help(SET));
|
||||
output.insert(ModuleId::BOX, deserialize_help(BOX));
|
||||
output.insert(ModuleId::NUM, deserialize_help(NUM));
|
||||
}
|
||||
|
||||
output
|
||||
}
|
||||
|
|
|
@ -1089,7 +1089,7 @@ pub fn load<'a>(
|
|||
|
||||
/// Load using only a single thread; used when compiling to webassembly
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn load_single_threaded<'a>(
|
||||
pub fn load_single_threaded<'a>(
|
||||
arena: &'a Bump,
|
||||
load_start: LoadStart<'a>,
|
||||
src_dir: &Path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue