Skip to content

Commit

Permalink
compress compiled object
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicent Chen committed Apr 29, 2021
1 parent 2252692 commit 280d92e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Code/Tools/FBuild/FBuildCore/Protocol/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Tools/FBuild/FBuildCore/Helpers/MultiBuffer.h>
#include "Tools/FBuild/FBuildCore/WorkerPool/Job.h"
#include "Tools/FBuild/FBuildCore/WorkerPool/JobQueue.h"
#include "Tools/FBuild/FBuildCore/Helpers/Compressor.h"

#include "Core/Env/ErrorFormat.h"
#include "Core/FileIO/ConstMemoryStream.h"
Expand Down Expand Up @@ -500,6 +501,9 @@ void Client::Process( const ConnectionInfo * connection, const Protocol::MsgJobR
uint32_t buildTime;
ms.Read( buildTime );

bool isDataCompressed = false;
ms.Read( isDataCompressed );

uint16_t remoteThreadId = 0;
ms.Read( remoteThreadId );

Expand Down Expand Up @@ -547,6 +551,16 @@ void Client::Process( const ConnectionInfo * connection, const Protocol::MsgJobR
if ( result == true )
{
// built ok - serialize to disc


Compressor c;
if (isDataCompressed)
{
c.Decompress(data);
data = c.GetResult();
dataSize = (uint32_t)c.GetResultSize();
}

MultiBuffer mb( data, dataSize );

ObjectNode * objectNode = job->GetNode()->CastTo< ObjectNode >();
Expand Down
1 change: 1 addition & 0 deletions Code/Tools/FBuild/FBuildCore/Protocol/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ void Server::FinalizeCompletedJobs()
ms.Write( job->GetSystemErrorCount() > 0 );
ms.Write( job->GetMessages() );
ms.Write( job->GetNode()->GetLastBuildTime() );
ms.Write( job->IsDataCompressed() );
ms.Write( job->GetRemoteThreadIndex() ); // The thread used to build the job to assist with visualization

// write the data - build result for success, or output+errors for failure
Expand Down
8 changes: 7 additions & 1 deletion Code/Tools/FBuild/FBuildCore/WorkerPool/JobQueueRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Tools/FBuild/FBuildCore/Graph/ObjectNode.h"
#include "Tools/FBuild/FBuildCore/Helpers/BuildProfiler.h"
#include "Tools/FBuild/FBuildCore/Helpers/MultiBuffer.h"
#include "Tools/FBuild/FBuildCore/Helpers/Compressor.h"

// Core
#include "Core/Env/ErrorFormat.h"
Expand Down Expand Up @@ -450,7 +451,12 @@ void JobQueueRemote::FinishedProcessingJob( Job * job, bool success )
// transfer data to job
size_t memSize;
void * mem = mb.Release( memSize );
job->OwnData( mem, memSize );
// job->OwnData( mem, memSize );

Compressor c;
c.Compress(mem, memSize);
size_t compressedSize = c.GetResultSize();
job->OwnData( c.ReleaseResult(), compressedSize, true );

return true;
}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ This FASTBuild branch is based on v1.04, and modified to fit Unreal 4.26.2, curr
- VS2019 Community 14.28.29910
- Windows SDK 10.0.19041.0

If other platform or compiler is used, `.bff` file in `External/SDK` should be modified.
If different version platform or compiler is used, `.bff` file in `External/SDK` should be modified.

For example, if you are using Windows SDK 10.0.17763.0, version number in `External/SDK/Windows/Windows10SDK.bff` should be modified. If you are using VS2019 Enterprise or a different version, version number in `External/SDK/VisualStudio/VisualStudio.bff` and `External/SDK/VisualStudio/VS2019.bff` should be modified.

## Usage
1. Compile this project: run FBuild.exe (official v1.04 release) `FBuild.exe All-x64-Release -dist -clean` in path `Code/`.
Expand Down

0 comments on commit 280d92e

Please sign in to comment.