Skip to content

Commit

Permalink
Performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
knno committed May 22, 2024
1 parent 0bf3e6f commit 793c1e4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
6 changes: 3 additions & 3 deletions docs/0.2/Kengine-Constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Whether index assets at start of Kengine.
Whether Auto indexing should be asynchronous at game start.


**Default**: <code>false</code>
**Default**: <code>true</code>
**Read only**: true
<!-- tabs:end -->

Expand All @@ -398,10 +398,10 @@ Whether Auto indexing should be asynchronous at game start.

##### **Description**

Auto indexing chunk size for async. Recommended average is 10-200.
Auto indexing chunk size for async. Recommended average is 5-25.


**Default**: <code>10</code>
**Default**: <code>5</code>
**Read only**: true
<!-- tabs:end -->

2 changes: 2 additions & 0 deletions src/scripts/KengineAssetTypes/KengineAssetTypes.gml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function KengineAssetTypes() {
default_private: false,
// A filter function for when indexing script assets.
index_asset_filter: function(asset) {
if string_count("@",asset.name) > 0 return false; // Filter out all unncessary scripts.

// Remove script assets (even if renamed) that are added already to the index.
// This happens because Script assets and function references are returned as 2d array by asset_get_ids.
// What we want is the function references.
Expand Down
20 changes: 10 additions & 10 deletions src/scripts/KengineAssetTypes/KengineAssetTypes.yy
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$GMScript":"",
"%Name":"KengineAssetTypes",
"isCompatibility":false,
"isDnD":false,
"name":"KengineAssetTypes",
"parent":{
"name":"Kengine",
"path":"folders/Kengine.yy",
"$GMScript": "",
"%Name": "KengineAssetTypes",
"isCompatibility": false,
"isDnD": false,
"name": "KengineAssetTypes",
"parent": {
"name": "Kengine",
"path": "folders/Kengine.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
"resourceType": "GMScript",
"resourceVersion": "2.0",
}
12 changes: 6 additions & 6 deletions src/scripts/KengineConfig/KengineConfig.gml
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,21 @@ enum KENGINE_PANELS_SCROLLBAR_TYPE {
* @description Whether Auto indexing should be asynchronous at game start.
* @type {Bool}
* @readonly
* @defaultvalue false
* @defaultvalue true
*
*/
#macro KENGINE_ASSET_TYPES_AUTO_INDEX_ASYNC (false)
#macro KENGINE_ASSET_TYPES_AUTO_INDEX_ASYNC (true)

/**
* @constant KENGINE_ASSET_TYPES_INDEX_CHUNK_SIZE
* @memberof Kengine~Constants
* @description Auto indexing chunk size for async. Recommended average is 10-200.
* @description Auto indexing chunk size for async. Recommended average is 5-25.
* @type {Real}
* @readonly
* @defaultvalue 10
* @defaultvalue 5
*
*/
#macro KENGINE_ASSET_TYPES_INDEX_CHUNK_SIZE (10)
#macro KENGINE_ASSET_TYPES_INDEX_CHUNK_SIZE (5)

/**
* @member KENGINE_CONSOLE_ENABLED
Expand Down Expand Up @@ -259,7 +259,7 @@ enum KENGINE_PANELS_SCROLLBAR_TYPE {
* @defaultvalue 0
*
*/
#macro KENGINE_VERBOSITY ((os_get_config() == "Debug" || os_get_config() == "Benchmark" || os_get_config() == "Test") ? 2 : 0)
#macro KENGINE_VERBOSITY ((os_get_config() == "Debug" || os_get_config() == "Benchmark" || os_get_config() == "Test") ? 3 : 0)

/**
* @member KENGINE_BENCHMARK
Expand Down
20 changes: 10 additions & 10 deletions src/scripts/KengineConfig/KengineConfig.yy
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$GMScript":"",
"%Name":"KengineConfig",
"isCompatibility":false,
"isDnD":false,
"name":"KengineConfig",
"parent":{
"name":"Kengine",
"path":"folders/Kengine.yy",
"$GMScript": "",
"%Name": "KengineConfig",
"isCompatibility": false,
"isDnD": false,
"name": "KengineConfig",
"parent": {
"name": "Kengine",
"path": "folders/Kengine.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
"resourceType": "GMScript",
"resourceVersion": "2.0",
}
2 changes: 1 addition & 1 deletion src/scripts/__KengineAssetType/__KengineAssetType.gml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function __KengineAssetType(name, asset_kind=KENGINE_CUSTOM_ASSET_KIND, indexing
*
*/
self.IndexAssets = function(indexing_options=undefined) {
static chunk_size = KENGINE_ASSET_TYPES_AUTO_INDEX_ASYNC ? 0 : KENGINE_ASSET_TYPES_INDEX_CHUNK_SIZE
static chunk_size = KENGINE_ASSET_TYPES_AUTO_INDEX_ASYNC ? KENGINE_ASSET_TYPES_INDEX_CHUNK_SIZE : 0
static __index_assets_halt = {halt: true}
static __indices_are_assets = false

Expand Down

0 comments on commit 793c1e4

Please sign in to comment.