Skip to content

Conversation

@RuffledPlume
Copy link
Contributor

A FIFO cache around theModelOverride::AhslPredicate results for given Ahsl keys, cache is made up of Longs, 32 bits for the ahsl, 1 bit for the result, are 31 bits for the age used during eviction.

Cache by default starts at 16 & has an upper limit of 512 values before it'll begin evicting values by the oldest first.

@RuffledPlume RuffledPlume force-pushed the AhslPredicateCache branch 4 times, most recently from eca39a2 to acfe05b Compare December 23, 2025 05:35
@RuffledPlume RuffledPlume changed the title Implemented AhslPredicateCache Implemented AhslPredicateCache & Int OpenHashMap & OpenSet Dec 23, 2025
@RuffledPlume RuffledPlume changed the title Implemented AhslPredicateCache & Int OpenHashMap & OpenSet Garbage Reduction, Dynamic/Temp Draw Optimizations, Int2Int Collection Dec 25, 2025
@RuffledPlume
Copy link
Contributor Author

RuffledPlume commented Dec 26, 2025

Master
image

image

PR:
image

image

At a glance Differences:

Garbage
Significantly less garbage generation per frame, Master performs a GC every 5 seconds so 20 every minute, PR performs a GC every one minute & 13 seconds.

Scene Frame Time
uploadTempModel & uploadSortedModel have been optimised to reduce garbage generation & tweaked to yield a 6 MS saving

ProcGen
Reduced Garbage Generation by switching over to the Int2XXX Collection rather than using a HashMap<Integer, XXX>
Less Garbage collects occur during scene load speeding up swap

@RuffledPlume
Copy link
Contributor Author

Remerged with Master + further optimizations to Int Collections:
image

@RuffledPlume RuffledPlume force-pushed the AhslPredicateCache branch 4 times, most recently from 06ec306 to 84833fc Compare December 31, 2025 01:48
Reduced ProcGen Garbage
Added Mummur Hash to reduce collisions
Improved LinearProbe by caching the accessed key, instead of reading it twice

Added IntHashSet

Switched Maps over to IntHashSet since the additional value was unnecessary
Pass in worldPos when getting tileOverride since it's already calculated

Fixed Iterator generating 500MB of garbage during scene load

Cache is read on multiple threads, we cannot guarantee the last alhsl value will be fully written in time

Cache the last searched key result

Added Bounds around multiple AABBs to allow for early out

Fixed Double Linear Probe

Implemented Robin Hood Hashing

Dynamic Model Upload Optimizations

Calculate Int Bits of Vertex position once instead of multiple times per face

Added Normalized value fast path for fp32 -> fp16 conversion

Calculate invLength instead of diving each axis

undoVanillaShading Tweaks

colorAdjust only needs to be calculated within the inner part of the if, otherwise the value isn't used

We can use nDotL instead of the length

Early out if value should be ignored

Early out on nDotL

Made FindIndex static since its consistent across all collections
Refactored LastRead into a 32 Byte ReadCache

findIndex optimizations

Switch GLState IntSet to use IntHashSet & not the generic HashSet

Tweaks

Pre-Compute SINE/COSINE Float Arrays matching Perspective.SINF/COSF

Tweaks
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.

1 participant