<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 12 August 2015 at 00:59, Martin Nowak <span dir="ltr"><<a href="mailto:code@dawg.eu" target="_blank">code@dawg.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 08/11/2015 04:38 PM, Iain Buclaw wrote:<br>
> Those extra memcpy calls look interesting.<br>
<br>
</span>Sure it looks interesting but it won't suffice for 30% and even for that<br>
10% we'd need to profile and optimize a lot of code during the next 6 weeks.<br>
<br>
Here's a breakdown of __memcpy_avx_unaligned callers.<br>
<br>
Samples: 40K of event 'cycles', Event count (approx.): 12450194501<br>
  Children      Self  Comm  Shared Objec  Symbol<br>
-    9.46%     3.44%  ddmd  <a href="http://libc-2.20.so" rel="noreferrer" target="_blank">libc-2.20.so</a>  [.] __memcpy_avx_unaligned<br>
   - __memcpy_avx_unaligned<br>
      + 9.06% TypeIdentifier::syntaxCopy<br>
      + 5.98% TemplateInstance::syntaxCopy<br>
      + 4.07% TemplateDeclaration::matchWithInstance<br>
      + 3.65% Scope::alloc<br>
      + 2.76% TemplateTypeParameter::matchArg<br>
      + 2.69% TemplateDeclaration::doHeaderInstantiation<br>
      + 2.20% TypeInstance::syntaxCopy<br>
      + 2.12% TemplateDeclaration::declareParameter<br>
      + 2.05% TemplateDeclaration::evaluateConstraint<br>
      + 1.82% functionResolve::ParamDeduce::fp<br>
      + 1.70% DsymbolExp::semantic<br>
      + 1.62% FuncDeclaration::semantic3<br>
      + 1.56% Parser::parsePrimaryExp<br>
      + 1.54% IsExp::syntaxCopy<br>
      + 1.54% TemplateDeclaration::deduceFunctionTemplateMatch<br>
      + 1.41% IdentifierExp::semantic<br>
      + 1.29% TypeFunction::syntaxCopy<br>
      + 1.27% AliasDeclaration::syntaxCopy<br>
      + 1.24% 0<br>
      + 1.21% VarDeclaration::syntaxCopy<br>
      + 1.10% Parser::parseDeclarations<br>
      + 1.09% StaticIfDeclaration::syntaxCopy<br>
      + 1.01% deduceType::DeduceType::visit<br>
      + 0.99% TemplateInstance::semantic<br>
      + 0.90% castTo::CastTo::visit<br>
      + 0.86% Scope::insert<br>
      + 0.83% Parser::parseBasicType<br>
      + 0.78% IsExp::semantic<br>
      + 0.75% TemplateInstance::findBestMatch::ParamBest::fp<br>
      + 0.73% TemplateTupleParameter::matchArg<br>
      + 0.65% Parameter::arraySyntaxCopy<br>
      + 0.64%<br>
_D4ddmd5mtype9TypeTuple6__ctorMFPS4ddmd4root5array41__T5ArrayTC4ddmd10expression10ExpressionZ5ArrayZC4ddmd5mtype9Type<br>
      + 0.61% ForeachStatement::semantic<br>
      + 0.58% IndexExp::semantic<br>
      + 0.57% TupleExp::semantic<br>
      + 0.57% ExpInitializer::syntaxCopy<br>
      + 0.57% functionResolve<br>
      + 0.56% CallExp::semantic<br>
      + 0.55% ScopeExp::semantic<br>
      + 0.55% VarDeclaration::semantic<br>
      + 0.54% FuncDeclaration::syntaxCopy<br>
      + 0.52% StringExp::semantic<br>
<br>
</blockquote></div><br><br></div><div class="gmail_extra">These are all places where class allocations occur the most it seems.<br><br>I was about to propose making this change:<br><br> extern (C) Object _d_newclass(const ClassInfo ci)<br> {<br>     auto p = allocmemory(ci.init.length);<br>+    *(cast(void **) p) = cast(void*) ci.vtbl;<br>-    p[0 .. ci.init.length] = cast(void[])ci.init[];<br>     return cast(Object)p;<br> }<br><br></div><div class="gmail_extra">But then I checked and found out that Daniel removes all ctors in the D conversion. =)<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">I guess this is the reason why memcpy calls have increased!<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Regards<br></div><div class="gmail_extra">Iain<br></div><div class="gmail_extra"><br></div></div>