Closed kevinresol closed 7 years ago
I have no idea. What's your Haxe version?
3.4.2
With -v
I see the log stayed at Typing macro tink.sql.macros.TableBuilder.getInt
for a long time.
@simn can you give us some directions?
@Simn I can't wait to do that, but as of late recent versions just break everything for me. Some hints as to what "flush" and "finalize" mean, so we can try to fix it for the latest stable?
Unfortunately, these times are not exactly accurate. "finalize" basically means "typing", and "flush" basically means "adding stuff to macro context".
I got this in latest haxe (https://github.com/HaxeFoundation/haxe/commit/96a60cb) and eval haxe (https://github.com/Simn/haxe/commit/6d7ca60c70f30fcca3f25a3fc80ac3cfd9af651b)
/Users/kevin/Codes/tink_sql/tests/Db.hx:44: characters 9-13 : tink.sql.Table0<Unknown<0>> has no field init
Apparently macro method is not inherited by child class.
Let alone the above error, the compiler still pauses at the line
Typing macro tink.sql.macros.TableBuilder.getInt
for a long time.
Does that literally mean the compiler spent a lot of time typing the getInt
function?
Any instructions on how to reproduce this?
I don't get very far trying to run the tests:
C:\GitHub\tink_sql>haxelib run travix neko
> haxe -lib tink_sql tests.hxml -lib travix -neko bin/neko/tests.n
tests/DbFixture.hx:21: characters 7-19 : Type not found : sys.db.Types
I tried adding -lib record-macros
to tests.hxml but that didn't help.
It's probably not the typing itself but something that happens afterwards and doesn't have a dedicated print.
This would be tricky, because it depends on the git versions of a few libraries. Let me try to come up with a reproducible example.
My entire haxelib repo is git versions, so that's not a problem.
If you don't mind using lix
It should be as simple as:
git checkout pure
npm install
npm run travix node .
I probably don't mind but you'll have to tell me what lix
is.
https://github.com/lix-pm/lix :smile:
But I think you don't need to do anything except running the three lines of code I quoted.
It fails because I'm not running a mysql server...
delete fixture.n
comment out DbFixture (non-macro part) like so:
// import sys.db.*;
// import sys.db.Types;
class DbFixture {
// static function connect(db, cb) {
// var cnx = Mysql.connect( { host: '127.0.0.1', user: 'root', pass: '', database: db } );
// cb(cnx);
// cnx.close();
// }
// static function clear() {
// connect('mysql', function (cnx) {
// cnx.request('DROP DATABASE IF EXISTS test');
// cnx.request('CREATE DATABASE test');
// });
// }
static function main() {
// clear();
}
}
Now it does something. How do I make it use my Haxe version? It seems to bundle 3.4.2 and use that by default.
on my mac I do this:
ln -s /usr/local/lib/haxe ~/haxe/versions/custom
this links the haxe folder, so that the haxe
executable is inside ~/haxe/versions/custom
then edit .haxerc
and change to "version": "custom"
The easiest way would be npm install switchx -g
and then switchx install 00b70f9
or something (it has to be the short hash used on the nightly builds). Or as Kevin suggests, you can dump it where it is looked up and edit your .haxerc file to reference it.
Thanks, that works I guess. I can reproduce the error you're getting, gonna bisect that.
The pattern matcher struggles with this switch: https://github.com/haxetink/tink_sql/blob/pure/src/tink/sql/macros/TableBuilder.hx#L66
I guess the extractors cause some exponential code explosion. I'll see what I can do, but it might not be so easy to change this. Maybe you could try rewriting that switch to see if it is indeed the main problem.
Thanks. I pushed a commit that seems to fix the speed issue. Closing for now.
The tests took >30s to compile on my MBP:
The
--times
report shows that the bottleneck is fromfinalize
andflush
, and I have no idea what it is.