-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oss release master created 2021-07-14-13-23
see CHANGELOG.md for details Original commit sha: 51e5ec514e6e80dd4cfe03c0f8db56966ebd630d Co-authored-by: Daniel Haas <25718295+bojackHaasman@users.noreply.github.com> Co-authored-by: Tobias Hammer <tohammer@users.noreply.github.com> Co-authored-by: Bernhard Kisslinger <65217745+bkisslinger@users.noreply.github.com> Co-authored-by: Violin Yanev <violinyanev@users.noreply.github.com>
- Loading branch information
1 parent
fb1080e
commit b61db6c
Showing
100 changed files
with
5,255 additions
and
4,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// ------------------------------------------------------------------------- | ||
// Copyright (C) 2021 BMW AG | ||
// ------------------------------------------------------------------------- | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
// ------------------------------------------------------------------------- | ||
|
||
#include "benchmark/benchmark.h" | ||
|
||
#include "ramses-logic/LogicEngine.h" | ||
#include "ramses-logic/Property.h" | ||
|
||
#include "fmt/format.h" | ||
#include <fstream> | ||
|
||
namespace rlogic | ||
{ | ||
static std::vector<char> CreateLargeLogicEngineBuffer(std::string_view fileName, int64_t scriptCount) | ||
{ | ||
LogicEngine logicEngine; | ||
|
||
const std::string scriptSrc = R"( | ||
function interface() | ||
for i = 0,20,1 do | ||
IN["dest"..tostring(i)] = INT | ||
OUT["src"..tostring(i)] = INT | ||
end | ||
end | ||
function run() | ||
end | ||
)"; | ||
|
||
std::vector<LuaScript*> scripts(scriptCount); | ||
for (int64_t i = 0; i < scriptCount; ++i) | ||
{ | ||
scripts[i] = logicEngine.createLuaScriptFromSource(scriptSrc); | ||
|
||
if (i >= 1) | ||
{ | ||
for (int64_t link = 0; link < 20; ++link) | ||
{ | ||
auto target = scripts[i]->getInputs()->getChild(fmt::format("dest{}", link)); | ||
auto src = scripts[i - 1]->getOutputs()->getChild(fmt::format("src{}", link)); | ||
logicEngine.link(*src, *target); | ||
} | ||
} | ||
} | ||
|
||
logicEngine.saveToFile(fileName); | ||
|
||
std::ifstream fileStream(std::string(fileName), std::ifstream::binary); | ||
fileStream.seekg(0, std::ios::end); | ||
std::vector<char> byteBuffer(static_cast<size_t>(fileStream.tellg())); | ||
fileStream.seekg(0, std::ios::beg); | ||
fileStream.read(byteBuffer.data(), byteBuffer.size()); | ||
return byteBuffer; | ||
} | ||
|
||
static void BM_LoadFromBuffer_WithVerifier(benchmark::State& state) | ||
{ | ||
const int64_t scriptCount = state.range(0); | ||
|
||
const std::vector<char> buffer = CreateLargeLogicEngineBuffer("largeFile.bin", scriptCount); | ||
|
||
for (auto _ : state) // NOLINT(clang-analyzer-deadcode.DeadStores) False positive | ||
{ | ||
LogicEngine logicEngine; | ||
logicEngine.loadFromBuffer(buffer.data(), buffer.size(), nullptr, true); | ||
} | ||
} | ||
|
||
// ARG: script count | ||
BENCHMARK(BM_LoadFromBuffer_WithVerifier)->Arg(8)->Arg(32)->Arg(128)->Unit(benchmark::kMicrosecond); | ||
|
||
static void BM_LoadFromBuffer_WithoutVerifier(benchmark::State& state) | ||
{ | ||
const int64_t scriptCount = state.range(0); | ||
|
||
const std::vector<char> buffer = CreateLargeLogicEngineBuffer("largeFile.bin", scriptCount); | ||
|
||
for (auto _ : state) // NOLINT(clang-analyzer-deadcode.DeadStores) False positive | ||
{ | ||
LogicEngine logicEngine; | ||
logicEngine.loadFromBuffer(buffer.data(), buffer.size(), nullptr, false); | ||
} | ||
} | ||
|
||
// ARG: script count | ||
BENCHMARK(BM_LoadFromBuffer_WithoutVerifier)->Arg(8)->Arg(32)->Arg(128)->Unit(benchmark::kMicrosecond); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
07be371ba5e5 | ||
07be371ce5e5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.