-D profileKiss to see each file's build() time

This commit is contained in:
2022-01-07 18:51:44 -07:00
parent d5e948c952
commit af293c142d
3 changed files with 80 additions and 58 deletions

View File

@@ -172,6 +172,10 @@ class AsyncEmbeddedScript {
scriptFile = Path.join([loadingDirectory, scriptFile]); scriptFile = Path.join([loadingDirectory, scriptFile]);
k.fieldList = []; k.fieldList = [];
Kiss._try(() -> { Kiss._try(() -> {
#if profileKiss
haxe.Timer.measure(() -> {
trace(scriptFile);
#end
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> { Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
var exprString = Reader.toString(nextExp.def); var exprString = Reader.toString(nextExp.def);
var expr = Kiss.readerExpToHaxeExpr(nextExp, k); var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
@@ -189,6 +193,9 @@ class AsyncEmbeddedScript {
return; return;
}); });
null; null;
#if profileKiss
});
#end
}); });
classFields = classFields.concat(k.fieldList); classFields = classFields.concat(k.fieldList);

View File

@@ -64,6 +64,10 @@ class EmbeddedScript {
scriptFile = Path.join([loadingDirectory, scriptFile]); scriptFile = Path.join([loadingDirectory, scriptFile]);
Kiss._try(() -> { Kiss._try(() -> {
#if profileKiss
haxe.Timer.measure(() -> {
trace(scriptFile);
#end
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> { Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
var expr = Kiss.readerExpToHaxeExpr(nextExp, k); var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
@@ -81,6 +85,9 @@ class EmbeddedScript {
// TODO test await // TODO test await
}); });
null; null;
#if profileKiss
});
#end
}); });
classFields.push({ classFields.push({

View File

@@ -164,6 +164,7 @@ class Kiss {
Build macro: add fields to a class from a corresponding .kiss file Build macro: add fields to a class from a corresponding .kiss file
**/ **/
public static function build(?kissFile:String, ?k:KissState, useClassFields = true):Array<Field> { public static function build(?kissFile:String, ?k:KissState, useClassFields = true):Array<Field> {
var classPath = Context.getPosInfos(Context.currentPos()).file; var classPath = Context.getPosInfos(Context.currentPos()).file;
// (load... ) relative to the original file // (load... ) relative to the original file
var loadingDirectory = Path.directory(classPath); var loadingDirectory = Path.directory(classPath);
@@ -173,6 +174,10 @@ class Kiss {
//trace('kiss build $kissFile'); //trace('kiss build $kissFile');
return _try(() -> { return _try(() -> {
#if profileKiss
haxe.Timer.measure(() -> {
trace(kissFile);
#end
if (k == null) if (k == null)
k = defaultKissState(); k = defaultKissState();
@@ -209,6 +214,9 @@ class Kiss {
} }
k.fieldList; k.fieldList;
#if profileKiss
});
#end
}); });
} }