-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: state chart debugger performance
fixes #24
- Loading branch information
Showing
5 changed files
with
173 additions
and
24 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,48 @@ | ||
|
||
|
||
## The content of the ring buffer | ||
var _content:Array[String] = [] | ||
|
||
## The current index in the ring buffer | ||
var _index = 0 | ||
|
||
## The size of the ring buffer | ||
var _size = 0 | ||
|
||
## Whether the buffer is fully populated | ||
var _filled = false | ||
|
||
|
||
func _init(size:int = 300): | ||
_size = size | ||
_content.resize(size) | ||
|
||
|
||
## Adds an item to the ring buffer | ||
func append(value:String): | ||
_content[_index] = value | ||
if _index + 1 < _size: | ||
_index += 1 | ||
else: | ||
_index = 0 | ||
_filled = true | ||
|
||
|
||
## Joins the items of the ring buffer into a big string | ||
func join(): | ||
var result = "" | ||
if _filled: | ||
# start by _index + 1, run to the end and then continue from the start | ||
for i in range(_index, _size): | ||
result += _content[i] | ||
|
||
# when not filled, just start at the beginning | ||
for i in _index: | ||
result += _content[i] | ||
|
||
return result | ||
|
||
|
||
func clear(): | ||
_index = 0 | ||
_filled = false |
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