internal/rosa: evaluate packages late

This also enables concurrent evaluation.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-19 01:26:21 +09:00
parent 8807cbc730
commit 4d60fa5632
3 changed files with 92 additions and 67 deletions

View File

@@ -614,11 +614,11 @@ var native S
// Native returns the global [S].
func Native() *S { return &native }
// evalTime is the duration of the initial built-in evaluation.
var evalTime time.Duration
// parseTime is the duration of early parsing of built-in azalea expressions.
var parseTime time.Duration
// EvalTime returns the duration of the initial built-in evaluation.
func EvalTime() time.Duration { return evalTime }
// ParseTime returns the time taken by early parsing of built-in azalea expressions.
func ParseTime() time.Duration { return parseTime }
// nativeB is the backing directory of built-in azalea-based [Artifact]
// implementations.
@@ -632,9 +632,9 @@ func init() {
panic(err)
}
t := time.Now()
if err = native.EvaluateFS(sub); err != nil {
if err = native.RegisterFS(sub); err != nil {
println(err.Error())
os.Exit(1)
}
evalTime = time.Since(t)
parseTime = time.Since(t)
}