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

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

View File

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

View File

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

View File

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