Skip to content

Micro-Optimization Glide#304

Merged
StyledStrike merged 3 commits into
StyledStrike:mainfrom
Vitroze:micro-opti
Jun 7, 2026
Merged

Micro-Optimization Glide#304
StyledStrike merged 3 commits into
StyledStrike:mainfrom
Vitroze:micro-opti

Conversation

@Vitroze

@Vitroze Vitroze commented Jun 6, 2026

Copy link
Copy Markdown
Contributor
  • Use Garry's Mod's native bit depth instead of 32-bit
  • Using the Glide function instead of rewriting the same code

@Vitroze Vitroze changed the title Use Garry's Mod's native bit depth instead of 32-bit Micro-Optimization Glide Jun 6, 2026
@StyledStrike

Copy link
Copy Markdown
Owner

I think the MAX_EDICT_BITS change is fine, but caching game.SinglePlayer is unecessary given that its not called every tick/frame. I've explained my reasons for that on #303

@Vitroze

Vitroze commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

I think the MAX_EDICT_BITS change is fine, but caching game.SinglePlayer is unecessary given that its not called every tick/frame. I've explained my reasons for that on #303

Indeed, the game.SinglePlayer parameter isn't necessary in some cases. Actually, I based it on the fact that the user could spam the toolgun button using a macro or auto-click. It's very neat, hence this pull request only concerns micro-optimization, but it's necessary to "save" a few nanoseconds.

@StyledStrike

StyledStrike commented Jun 7, 2026

Copy link
Copy Markdown
Owner

...the user could spam the toolgun button using a macro or auto-click.

Both the Engine Stream and Misc. Sounds tools prevent that by checking self:CanSendData()

@StyledStrike

Copy link
Copy Markdown
Owner

Besides, even with the Material tool that you can spam, game.SinglePlayer is nothing compared to the other dupe/list stuff that it checks.

That does not mean those other things have to be micro-optimized too, it just means that the toolgun is not slow enough to need that, and once again I come back to #303:

How likely is a section of code to be running constantly?

@Vitroze

Vitroze commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Besides, even with the Material tool that you can spam, game.SinglePlayer is nothing compared to the other dupe/list stuff that it checks.

That does not mean those other things have to be micro-optimized too, it just means that the toolgun is not slow enough to need that, and once again I come back to #303:

How likely is a section of code to be running constantly?

Okay, I understand. I'll modify my PR to include only MAX_EDICT_BITS and the WriteTable from Glide.

@StyledStrike StyledStrike added the enhancement New feature or request label Jun 7, 2026
@StyledStrike StyledStrike merged commit f5e607a into StyledStrike:main Jun 7, 2026
2 checks passed
@StyledStrike

Copy link
Copy Markdown
Owner

I forgot that data from Glide.lastStreamPresetData is a string, not a table, so it's causing an error when given to Glide.WriteTable. I'm going to fix it in a minute

@Vitroze Vitroze deleted the micro-opti branch June 7, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants