x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Performances (fps) loss when removing UE_LOG(SomeVariable)

I'm currently creating a plugin. Everything is fine during my debugging, but when I start removing UE_LOG() that lies around, suddenly I get a huge performance hit, about 1/5 of the original performances.

I started by searching if something was broken but everything still works fine and without any bugs of any kind. So I put back some UE_LOG() to see from where the bug is originating. And the performances came back to normal... So I incrementally removed every UE_LOG() to see what's happening.

I found out that there are 2 places where performances disappear when the UE_LOG() are removed. But if one of them is removed but not the other, the performances are hurt by some amount,. When it is the other one that is removed, the performances are hurt by another amount. And if both are removed, the performances are even lower with another amount which doesn't seem to be the addition of both loss...

To make things even weirder, the UE_LOG() are displaying a variable which is a simple bool used as return value of a function. This is the same variable in both cases and this variable is only used once (outside the UE_LOG()) for a conditional.

The code is inside a FRunnableThread as a FRunnable and looks like that:

 while (state == ECommandReceiverState::Running)
     {
         ReadChannelResult_UL = IPC_Read(ResultData);
         
         if (ReadChannelResult_UL != IPC_NOERROR)
         {
             if (!ProblematicVariable)
             {
                 ProblematicVariable = mpGPUResourcesSharingModule_O->Trigger(0);
                 UE_LOG(LogCommandReceiver, Warning, TEXT("%d"), ProblematicVariable);    //DO NOT REMOVE, Perfomances penalty (fps/5)
             }
             continue;
         }
 
         switch (ResultData->Id_UL)
         {
             case COMMONINPUT_ID_PARAMETER_RENDER:
                 if (ModuleIsLoaded)
                 {
                     ProblematicVariable = mpGPUResourcesSharingModule_O->Trigger(0);
                     UE_LOG(LogCommandReceiver, Warning, TEXT("%d"), ProblematicVariable);    //DO NOT REMOVE, Perfomances penalty (fps/5)
                 }
                 break;
             case COMMONINPUT_ID_PARAMETER_SETCAM:
                 ResultData[1] = *ResultData;
                 break;                
             case COMMONINPUT_ID_PARAMETER_SETROT:
                 ResultData[2] = *ResultData;
                 break;
             default:
                 UE_LOG(LogCommandReceiver, Error, TEXT("Unknown command id: %lu"), ResultData->Id_UL);
                 break;
         }
 
     }

I tried to search for optimization problems but couldn't find anything. I tried used Sleep(0) to trigger event if any (via the scheduler).

As you can see, there is no obvious reason for that to happen.

If you have any clue about a possible reason and/or fix for this issue, please share it.

Product Version: UE 4.20
Tags:
more ▼

asked Apr 09 '19 at 10:29 AM in C++ Programming

avatar image

AfroDiscoKappa
25 3 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question