[4Walter&Andrei] D is 40 times slower. We need a new language feature!
Vladimir Panteleev via Digitalmars-d
digitalmars-d at puremagic.com
Fri May 19 20:53:42 PDT 2017
On Saturday, 20 May 2017 at 03:24:41 UTC, 9il wrote:
> What can I do to make it happen?
Sounds like you're asking for opIndex currying?
https://en.wikipedia.org/wiki/Currying
Have you tried implementing opIndex as a function which takes a
single argument, and returns an object which then also implements
opIndex with a single argument? You would probably need to write
matrix[2][4] instead of matrix[2, 4], but that doesn't look hard
to fix as well.
> As was said optimizsers can not split opIndex body because it
> is function (inlined or not inlined does not matter).
Have you tried splitting the opIndex implementation into two
functions, one with just the code that should always be inlined,
and one with the rest of the code that doesn't necessarily have
to be inlined?
How about pragma(inline), does that help?
More information about the Digitalmars-d
mailing list