main: optimize 'tinygo run'
Apparently -Oz without inliner is the fastest, probably because it removes code that would otherwise need to be emitted. TODO: does this mean that the ExecutionEngine compiles the module before running it? Can we control this?
Этот коммит содержится в:
родитель
c9ae72a105
коммит
a2eaaa42a0
1 изменённых файлов: 4 добавлений и 1 удалений
5
main.go
5
main.go
|
@ -210,7 +210,10 @@ func Run(pkgName string) error {
|
||||||
if err := c.Verify(); err != nil {
|
if err := c.Verify(); err != nil {
|
||||||
return errors.New("compiler error: failed to verify module: " + err.Error())
|
return errors.New("compiler error: failed to verify module: " + err.Error())
|
||||||
}
|
}
|
||||||
c.Optimize(1, 0, 0) // -O1, the fastest optimization level that doesn't crash
|
// -Oz, which is the fastest optimization level (faster than -O0, -O1, -O2
|
||||||
|
// and -Os). Turn off the inliner, as the inliner increases optimization
|
||||||
|
// time.
|
||||||
|
c.Optimize(2, 2, 0)
|
||||||
|
|
||||||
engine, err := llvm.NewExecutionEngine(c.Module())
|
engine, err := llvm.NewExecutionEngine(c.Module())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче