Re: The cost of doing compile time introspection

2017-05-11 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 11 May 2017 at 21:09:05 UTC, Timon Gehr wrote: [...] Yes, this works and is a few times faster. It's slightly faster when inlining the condition: static foreach(fn;__traits(allMembers, functions)){ static if (isFunction!(__traits(getMember, functions, fn)) &&

Re: The cost of doing compile time introspection

2017-05-11 Thread Stefan Koch via Digitalmars-d
On Thursday, 11 May 2017 at 21:57:06 UTC, Timon Gehr wrote: On 10.05.2017 16:28, Stefan Koch wrote: On Wednesday, 10 May 2017 at 14:03:58 UTC, Biotronic wrote: On Wednesday, 10 May 2017 at 11:45:05 UTC, Moritz Maxeiner wrote: [CTFE slow] First, as you may know, Stefan Koch is working on an

Re: The cost of doing compile time introspection

2017-05-11 Thread Timon Gehr via Digitalmars-d
On 10.05.2017 16:28, Stefan Koch wrote: On Wednesday, 10 May 2017 at 14:03:58 UTC, Biotronic wrote: On Wednesday, 10 May 2017 at 11:45:05 UTC, Moritz Maxeiner wrote: [CTFE slow] First, as you may know, Stefan Koch is working on an improved CTFE engine that will hopefully make things a lot

Re: The cost of doing compile time introspection

2017-05-11 Thread Timon Gehr via Digitalmars-d
On 10.05.2017 16:03, Biotronic wrote: A few things here - functions.fn would not do what you want, and neither would __traits(identifier). functions.fn would treat "fn" like a part of name, not a string value, so this will make the poor compiler barf. __traits(identifier, fn) expects fn to be

Re: The cost of doing compile time introspection

2017-05-11 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 10 May 2017 at 14:03:58 UTC, Biotronic wrote: As for making the code faster right now, could this be done with mixin templates instead? Something like: import functions = llvm.functions.link; import std.meta, std.traits; template isCFunction(alias member) { static if

Re: The cost of doing compile time introspection

2017-05-10 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 10 May 2017 at 14:03:58 UTC, Biotronic wrote: On Wednesday, 10 May 2017 at 11:45:05 UTC, Moritz Maxeiner wrote: [CTFE slow] First, as you may know, Stefan Koch is working on an improved CTFE engine that will hopefully make things a lot better. As he already pointed out, it

Re: The cost of doing compile time introspection

2017-05-10 Thread Stefan Koch via Digitalmars-d
On Wednesday, 10 May 2017 at 14:03:58 UTC, Biotronic wrote: On Wednesday, 10 May 2017 at 11:45:05 UTC, Moritz Maxeiner wrote: [CTFE slow] First, as you may know, Stefan Koch is working on an improved CTFE engine that will hopefully make things a lot better. It will not; This is issue is

Re: The cost of doing compile time introspection

2017-05-10 Thread Biotronic via Digitalmars-d
On Wednesday, 10 May 2017 at 11:45:05 UTC, Moritz Maxeiner wrote: [CTFE slow] First, as you may know, Stefan Koch is working on an improved CTFE engine that will hopefully make things a lot better. As for making the code faster right now, could this be done with mixin templates instead?

The cost of doing compile time introspection

2017-05-10 Thread Moritz Maxeiner via Digitalmars-d
So, after being asked to support dynamic loading in llvm-d[1] at DConf 2017 I essentially had the following two options: - have two separate declarations of the bindings, one with the function signatures (linking) and one with function pointers (loading) - Have one declaration and derive the