-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from ImJimmi/interpreter-performance
Improve performance of `jive::Interpreter`
- Loading branch information
Showing
45 changed files
with
868 additions
and
193 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include_guard() | ||
|
||
add_library(jive_code_coverage INTERFACE) | ||
add_library(jive::code_coverage ALIAS jive_code_coverage) | ||
|
||
if (APPLE AND JIVE_ENABLE_COVERAGE) | ||
target_compile_options(jive_code_coverage | ||
INTERFACE | ||
--coverage | ||
) | ||
|
||
target_link_options(jive_code_coverage | ||
INTERFACE | ||
--coverage | ||
) | ||
endif() |
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,46 @@ | ||
include_guard() | ||
|
||
add_library(jive_compiler_and_linker_options INTERFACE) | ||
add_library(jive::compiler_and_linker_options ALIAS jive_compiler_and_linker_options) | ||
|
||
target_compile_definitions(jive_compiler_and_linker_options | ||
INTERFACE | ||
JUCE_DISABLE_JUCE_VERSION_PRINTING=1 | ||
JUCE_DISPLAY_SPLASH_SCREEN=0 | ||
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1 | ||
JUCE_USE_CURL=0 | ||
JUCE_WEB_BROWSER=0 | ||
) | ||
|
||
if (APPLE) | ||
target_compile_options(jive_compiler_and_linker_options | ||
INTERFACE | ||
-Werror | ||
) | ||
|
||
target_link_options(jive_compiler_and_linker_options | ||
INTERFACE | ||
-Wl,-weak_reference_mismatches,weak | ||
) | ||
|
||
if (JIVE_ENABLE_SANITISERS) | ||
target_compile_options(jive_compiler_and_linker_options | ||
INTERFACE | ||
-fsanitize=address | ||
-fsanitize=undefined | ||
) | ||
|
||
target_link_options(jive_compiler_and_linker_options | ||
INTERFACE | ||
-fsanitize=address | ||
-fsanitize=undefined | ||
) | ||
endif() | ||
endif() | ||
|
||
if (MSVC) | ||
target_compile_options(jive_compiler_and_linker_options | ||
INTERFACE | ||
/WX | ||
) | ||
endif() |
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,6 @@ | ||
include_guard() | ||
|
||
option(JIVE_BUILD_TEST_RUNNER "Build JIVE's test runner?" OFF) | ||
option(JIVE_BUILD_DEMO_RUNNER "Build JIVE's demo runner?" OFF) | ||
option(JIVE_ENABLE_COVERAGE "Generate coverage reports when running tests?" OFF) | ||
option(JIVE_ENABLE_SANITISERS "Enable ASan, LSan, UBSan?" OFF) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "jive_ConsoleProgressBar.h" | ||
|
||
namespace jive | ||
{ | ||
static const juce::Array<juce::juce_wchar> blocks{ | ||
' ', // | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8f" }, // ▏ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8e" }, // ▎ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8d" }, // ▍ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8c" }, // ▌ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8b" }, // ▋ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x8a" }, // ▊ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x89" }, // ▉ | ||
*juce::CharPointer_UTF8{ "\xe2\x96\x88" }, // █ | ||
}; | ||
|
||
[[nodiscard]] juce::String buildProgressBar(double progressNormalised, int maxStringLength) | ||
{ | ||
jassert(progressNormalised >= 0.0 && progressNormalised <= 1.0); | ||
progressNormalised = juce::jlimit(0.0, 1.0, progressNormalised); | ||
|
||
static constexpr auto decimalPlaces = 2; | ||
static constexpr auto hundredPercentAndWhitespaceWidth = decimalPlaces + 6; // 100.00% | ||
const auto barLength = maxStringLength - hundredPercentAndWhitespaceWidth - 2; | ||
const auto filledPortionExactWidth = barLength * progressNormalised; | ||
const auto numFull = static_cast<int>(std::floor(filledPortionExactWidth)); | ||
const auto partialBlock = blocks[juce::roundToInt((filledPortionExactWidth - numFull) * (blocks.size() - 1))]; | ||
const auto bar = juce::String{} | ||
.paddedRight(blocks.getLast(), numFull) | ||
.paddedRight(partialBlock, juce::jmin(numFull + 1, barLength)) | ||
.paddedRight(blocks.getFirst(), barLength); | ||
|
||
static const juce::String cap{ juce::CharPointer_UTF8("\xe2\x94\x82") }; | ||
const auto percentage = (juce::String{ progressNormalised * 100, decimalPlaces } | ||
+ "%") | ||
.paddedLeft(' ', hundredPercentAndWhitespaceWidth); | ||
|
||
return cap + bar + cap + percentage; | ||
} | ||
} // namespace jive |
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,6 @@ | ||
#pragma once | ||
|
||
namespace jive | ||
{ | ||
[[nodiscard]] juce::String buildProgressBar(double progressNormalised, int maxStringLength = 50); | ||
} // namespace jive |
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.