Skip to content

Performance improvements through Chip Caching#30

Merged
just-another-alien merged 7 commits into
firecerne:devfrom
CC56785:community_edition
Jul 26, 2025
Merged

Performance improvements through Chip Caching#30
just-another-alien merged 7 commits into
firecerne:devfrom
CC56785:community_edition

Conversation

@CC56785

@CC56785 CC56785 commented Jul 17, 2025

Copy link
Copy Markdown

See this for more info.

@just-another-alien

Copy link
Copy Markdown
Collaborator

I just resolved the errors using GitHub‘s web editor. I can‘t test it right now or fix the PinState stuff etc, maybe @firecerne can do that if he has the time?

@just-another-alien just-another-alien merged commit 5966af0 into firecerne:dev Jul 26, 2025
just-another-alien added a commit that referenced this pull request Aug 10, 2025
* Performance improvements through Chip Caching (#30)

* added caching of purely combinational chips

* fixed chip caching; now always works correctly

* Added extra ui in the chip customization menu to let the user manually activate caching on larger chips.

* added info popup while creating a cache

* fixed recalculation of caches to only happen when actually necessary

* caching now gets disabled when viewing so cached chips actually show whats happening

---------

Co-authored-by: Chris <christianilhoefer@gmail.com>
Co-authored-by: Logic Mindful <master51.main@gmail.com>

* Precom edit (#33)

only really includes the last commit - everything else has already been added i'm just bad with git

* fixed a small error.

* Fix custom pin position issues on saving

Changes how chip descriptions are created, now accounting for custom pin layout (positions and presence of layout).

In addition, it fixes how the game sometimes falsly registers chips as unsaved when they have custom pin layouts.

It feels wrong to directly commit here.

* Custom special chip deletion

Players are now able to delete their custom i/o and split/merge (only in pairs). The base i/o and split merge are excluded from this.

* Can delete custom buses

Buses are now able to be deleted. They can't be manually deleted alone, but only when a custom bitcount is deleted.
Delete IN-12 -> also deletes OUT-12 and BUS

* Prevents user from creating same size split/merge

Makes it impossible to create split/merges such as 16-16 or 4-4 or 1-1, because they are useless and cause problems.

* Flat colour fix

Wires now are of a flat color (on/off of the same color) only after 64, not starting from 64.

* Removes Saver debug logs

* Fixes name label placement on top/bottom pins

Top/Bottom pin name labels are no longer excruciatingly spaced away from their pins.

* Added an indicator of mod version on main menu

I choose 1.2.0 as I think it will be the next update. We can always change it.

I changed the modid of current version to 1.2.0.

We will have to set the update date the day we release the new update.

* Changes to EditorDebugUpdate for easier debugging

* Fixes freezes when using the random ram values

Stops the content of the ram from overflowing out of the 8 bytes it is supposed to have (would be a shame if a  8 bit wire contained 16 bit of data)

* Stats menu responds to escape shortcut

* Optimization and Bug Fixes For The New Cache Mechanism (#34)

* Reduced recursion in cache generation and decreased cache dictionary lookups, both to the effect of improving the performance of cache generation and the latter improving cache performance overall. Refactored some of the cache related code to the SimChip class. Fixed a bug where output pins larger than 16 bits were being cached even though the current cache mechanism can not handle them. Fixed a bug where tri-stated outputs were being cached as low outputs. Partially fixed a bug where chips being modified did not cause their parent chips to regenerate their cache. Fixed a bug where caches would continue to generate even after switching to another chip. Marked ROM chips as combinational.

* Finished refactoring most of the cache code into SimChip. Fully fixed the bug causing parent chips to not recache when their children do. Fixed a bug which allowed chips with loops to cache if the loop was only a single chip, allowing stateful chips to potentially cache and break.

* Update version + release date (hopefully right)

* Pinstatevalue fix + output of Pulse chip

Caused a sim freezing bug when a pulse chip would output to a single-input cached chip.

* Update update date

---------

Co-authored-by: CC56785 <109369210+CC56785@users.noreply.github.com>
Co-authored-by: Chris <christianilhoefer@gmail.com>
Co-authored-by: Logic Mindful <master51.main@gmail.com>
Co-authored-by: Imred-Gemu <3dsusernamedimred9001@gmail.com>
just-another-alien added a commit that referenced this pull request Feb 7, 2026
* Performance improvements through Chip Caching (#30)

* added caching of purely combinational chips

* fixed chip caching; now always works correctly

* Added extra ui in the chip customization menu to let the user manually activate caching on larger chips.

* added info popup while creating a cache

* fixed recalculation of caches to only happen when actually necessary

* caching now gets disabled when viewing so cached chips actually show whats happening

---------

Co-authored-by: Chris <christianilhoefer@gmail.com>
Co-authored-by: Logic Mindful <master51.main@gmail.com>

* Precom edit (#33)

only really includes the last commit - everything else has already been added i'm just bad with git

* fixed a small error.

* Fix custom pin position issues on saving

Changes how chip descriptions are created, now accounting for custom pin layout (positions and presence of layout).

In addition, it fixes how the game sometimes falsly registers chips as unsaved when they have custom pin layouts.

It feels wrong to directly commit here.

* Custom special chip deletion

Players are now able to delete their custom i/o and split/merge (only in pairs). The base i/o and split merge are excluded from this.

* Can delete custom buses

Buses are now able to be deleted. They can't be manually deleted alone, but only when a custom bitcount is deleted.
Delete IN-12 -> also deletes OUT-12 and BUS

* Prevents user from creating same size split/merge

Makes it impossible to create split/merges such as 16-16 or 4-4 or 1-1, because they are useless and cause problems.

* Flat colour fix

Wires now are of a flat color (on/off of the same color) only after 64, not starting from 64.

* Removes Saver debug logs

* Fixes name label placement on top/bottom pins

Top/Bottom pin name labels are no longer excruciatingly spaced away from their pins.

* Added an indicator of mod version on main menu

I choose 1.2.0 as I think it will be the next update. We can always change it.

I changed the modid of current version to 1.2.0.

We will have to set the update date the day we release the new update.

* Changes to EditorDebugUpdate for easier debugging

* Fixes freezes when using the random ram values

Stops the content of the ram from overflowing out of the 8 bytes it is supposed to have (would be a shame if a  8 bit wire contained 16 bit of data)

* Stats menu responds to escape shortcut

* Optimization and Bug Fixes For The New Cache Mechanism (#34)

* Reduced recursion in cache generation and decreased cache dictionary lookups, both to the effect of improving the performance of cache generation and the latter improving cache performance overall. Refactored some of the cache related code to the SimChip class. Fixed a bug where output pins larger than 16 bits were being cached even though the current cache mechanism can not handle them. Fixed a bug where tri-stated outputs were being cached as low outputs. Partially fixed a bug where chips being modified did not cause their parent chips to regenerate their cache. Fixed a bug where caches would continue to generate even after switching to another chip. Marked ROM chips as combinational.

* Finished refactoring most of the cache code into SimChip. Fully fixed the bug causing parent chips to not recache when their children do. Fixed a bug which allowed chips with loops to cache if the loop was only a single chip, allowing stateful chips to potentially cache and break.

* Update version + release date (hopefully right)

* Pinstatevalue fix + output of Pulse chip

Caused a sim freezing bug when a pulse chip would output to a single-input cached chip.

* Update update date

* Fixed Button/Dip switch/LED being able to cache

* Fixed caching not disabling for key chip

* Updated the cache logic to resepect the canCache property from the chip's description. As IsCombinational now respects this property, the if statement in the chip customization menu was redundant and has been removed. The block of switch/cases handling whether a builtin chip is combinational or not has been replaced by setting the canCache property appropriately for every builtin chip type. (#37)

* Add touchscreen RGB display and optimize stats (#36)

* Update projectdescription to remove invalid chips

* Initial commit for touchscreen

* Increase bounds

---------

Co-authored-by: Logic Mindful <master51.main@gmail.com>

* Fix medium bus behaviour

* Save check fix (#42)

This should remove the "unsaved changes" notification that appears for no reason sometimes.

* Automatic resave when chip version doesn't match

Instead of leaving the user with the responsability to save themself when there is simply a version difference, the chip will now save itself when opened if it is the case.

* Fixes save check regarding pin face

Fixes the pin face of the pins in the chipdescriptions generated when checking for modifications

---------

Co-authored-by: firecerne <105079722+firecerne@users.noreply.github.com>

* Hotkey customization (#47)

* Shortcuts refactor (wtih new ShortcutSettings file)

Changes introduced to how the shortcuts / hotkeys work to enable customization in the future.
Hotkeys are now stored in a ShortcutSettings file (it has support for modifiers, alternative modifiers, alternative keys, and forbidden modifiers).

* Change shortcut preview to the one set in ShortcutSettings.

The shortcut preview string on the "menu" button on the bottom bar now directly corresponds to the one set in the ShortcutSettings (whatever it may be).

Added a MenuHelper method to return the string representation of a shortcut.

* Added automatic padding to bottom bar ui menu collapsable

* Custom Hotkeys edition menu

Added a menu to edit hotkeys in game. (in settings > controls)
Corrected a small error that made complex shortcuts (with alternative keys/modifiers) not register.
Changed Shortcuts from struct to class to make things easier.
Added methods to InputHelper to more precisely record inputs (useful for detecting hotkey setting inputs and other cases where it is needed)

* Use FacingDir to compute pin position (#48)

Fixes #46

* Remove need for tvOS

* Added more keys (#49)

* More keys

I changed the key system, added a bunch of keys, and a mode to be able to use ctrls, alts, and shift. (Use right alt + f12, as it's not used much)

* Bug fixes and updates

Fixed key bugs and made sure this can work with the new updates.

* Changed key chip to use KeyCode and mapping

Replaces old system of using enums and stuff which is slower.

* Add lock mode, scroll key support, and no keys pressed in key chip.

Adds lock mode that disables most user interactions and UI elements when enabled. Adds support for scroll wheel as a key input for key chips. And adds no key pressed feature in key chip.

* Update Unity version from 6.046f1 to 6.37f1

This decision was made because of security vulnerabilities found in the previous version.
This can be temporary as we will probably part ways with Unity when the opportunity emerges

* Hotkey logic fix

Bug : When alternative keys were available in shortcuts, the shortcut was deemed used only when both standard and alternative keys where pressed.
Fix :  Either of them can be pressed.

* Update version and release date in advance of release.

* Fixed chip customisation issues with resizing

* Fix large bitwidth wires behaviour when conflict

* Increment release

---------

Co-authored-by: CC56785 <109369210+CC56785@users.noreply.github.com>
Co-authored-by: Chris <christianilhoefer@gmail.com>
Co-authored-by: Logic Mindful <master51.main@gmail.com>
Co-authored-by: Imred-Gemu <3dsusernamedimred9001@gmail.com>
Co-authored-by: BeboKhouja <mokkachocolata@gmail.com>
Co-authored-by: kythetigerz <kythetigerz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants