Big Performance Issues during Sketchup Export with Windows Defender Enabled

Hi there,

I’m having a significant performance problem during a Sketchup Export in our application.

When Windows Defender is enabled, our export takes over 4 - 8x as long. I’ve run some profiling sessions, and it looks like the most time is being spent inside SUEdgeCreate, SUEntitiesAddEdges, and SUDrawingElementSetLayer.

Inside these functions, there is a lot of time being spent in the CRT functions _ioinit, and especially _fclose_nolock.

Since slapi.dll doesn’t come with debug symbols, this is as far as I’ve made it in attempting to diagnose the issue.

Is this a known issue with the Sketchup Export functions, or a problem with Windows Defender? It seems quite odd that performance would degrade this badly. We have many, many users that will have this enabled by default, and it just torpedoes export performance.

Any help or suggestions would be appreciated.

Thanks,

Fred

Yea, I’ve heard of that before. Though I don’t understand why Windows Defender should have such an impact - makes no sense.

What Windows version are you on?

Windows 8.1, but I believe we’re having the same issue with Defender/Microsoft Security Essentials on Windows 7 as well.

Windows 8.1 - did MS re-brand MSE as Defender and ship it with the OS in that release?

In any case, I’m bumping our internal issue on this one.

Any chance you could share a sample C API code snippet with us where you see this? And comment which lines you see it? Just so we are 100% sure we are looking at the same thing.

I think you may be right about the MS re-brand, but I’m not certain about that one off hand.

As to the code, we’re really not doing anything extraordinary - more or less following the examples by the book. When defender is enabled, each function takes the same % of the total CPU time as before, it’s just that the total time is quadrupled (sometimes worse).

Here’s a simple example - the last three lines are where the bulk of the time is spent:

void SkpWriteLine(double x1, double y1, double x2, double y2, SULayerRef lyr, SUEntitiesRef entities, double xOff, double yOff)
    {
    	SUPoint3D start;
    	SUPoint3D end;
    	SUEdgeRef edge = SU_INVALID;
    
    	SkpInitPt(&start,x1+xOff,y1+yOff);
    	SkpInitPt(&end,x2+xOff,y2+yOff);
    			
    	SUSetInvalid(edge);

    	SUEdgeCreate(&edge,&start,&end);  //this is slower
    	SUEntitiesAddEdges(entities,1,&edge);  //this too!
    	SUDrawingElementSetLayer(SUEdgeToDrawingElement(edge), lyr);  //and this
    
    }

One other thing I noticed is that when defender is not active, the number of samples taken in ioinit very roughly matched the number of samples in fclose_nolock (41.7 and 41.52% respectively) - when defender is enabled, this skews towards fclose_nolock (36.12 and 49.61% respectively).

Appreciate you bumping the internal issue - hope this information helps.

We’ve seen this even in SketchUp when using the Ruby API.

I am also seeing the same big slowdown when real-time protection is enabled in Windows Defender, when exporting a model. As an example from my code:

MyClass::SetEdgeLayer( SUEntitiesRef entities, SULayerRef layer ) {
  size_t edgeCount = 0;
  SUEntitiesGetNumEdges( entities, false, &edgeCount );
  std::vector<SUEdgeRef> edges( edgeCount );
  SUEntitiesGetEdges( entities, false, edgeCount, &edges[ 0 ], &edgeCount );
  for ( auto iter = edges.begin(); iter != edges.end(); iter++ ) {
    SUDrawingElementRef edge = SUEdgeToDrawingElement( *iter );
    if ( SUIsValid( edge ) ) {
      SUDrawingElementSetLayer( edge, layer );
    }
  }
}

If I exclude my compiled exe in the Windows Defender settings (under excluded processes) then the problem goes away, so there must be some issue with the real-time scanning. This is on Windows 8.1, which I think comes with Windows Defender installed by default.

James

I’m bumping this issue internally. (Internal ref: SU-29841)