1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

make V compile itself using cached modules: ~0.3s speed-up

This commit is contained in:
Alexander Medvednikov
2019-10-10 02:59:33 +03:00
parent 2ee252be5f
commit 4d941b5fdb
3 changed files with 23 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ import (
/*
.vh generation logic.
.vh files contains only function signatures, consts, and types.
.vh files contain only function signatures, consts, and types.
They are used together with pre-compiled modules.
*/
@@ -95,7 +95,11 @@ fn v_type_str(typ_ string) string {
return '[]' + typ.right(6)
}
if typ.contains('__') {
return typ.all_after('__')
opt := typ.starts_with('?')
typ = typ.all_after('__')
if opt {
typ = '?' + typ
}
}
return typ
}
@@ -213,8 +217,8 @@ fn (v &V) generate_vh() {
// Methods
file.writeln('\n// Methods //////////////////')
for _, typ in v.table.typesmap {
if typ.mod != v.mod { //&& typ.mod != '' {
//println('skipping method typ $typ.name mod=$typ.mod')
if typ.mod != v.mod && !(v.mod == 'builtin' && typ.mod == '') {
println('skipping method typ $typ.name mod=$typ.mod')
continue
}
for method in typ.methods {