TypeFunction example: ImplictConvTargets

Jon Degenhardt jond at noreply.com
Wed Oct 7 16:35:15 UTC 2020


On Wednesday, 7 October 2020 at 14:41:18 UTC, H. S. Teoh wrote:
> On Wed, Oct 07, 2020 at 10:10:56AM -0400, Steven Schveighoffer 
> via Digitalmars-d wrote: [...]
>> memchr is also the secret sauce to how iopipe was able to beat 
>> Phobos byLine and getline.
>> 
>> I would like to go back to it at some point and see if it can 
>> be improved.
>> 
>> I know that part of the difference would be due to the opaque 
>> function call (this cannot be inlined), though perhaps memchr 
>> is an intrinsic?
> [...]
>
> I wouldn't be surprised if optimizing compilers like ldc 
> treated it as an intrinsic.  IIRC, ldc already recognizes 
> memcpy as an intrinsic and therefore knows how to inline it / 
> substitute it with suitable instructions in special cases, even 
> though it's supposed to be "opaque".

It's my understanding that LTO could be used to cross the 
language boundary as well, allowing otherwise opaque function 
calls to be inlined. It would require having the function 
compiled to IR code available at build time.

Related to earlier in this subthread - I regularly work with data 
file 20 bytes per line and others 5000 bytes per line. It's been 
my experience that the two can have quite different performance 
characteristics for the same operation. As pointed out, it is 
sometimes hard to optimize for both.

--Jon


More information about the Digitalmars-d mailing list