Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace fscanf with faster parsing #2 #152

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

KaelaSavia
Copy link
Contributor

Credits to original pull #127 @PeakKS

Introduces faster parsing to ModuleInMemory.

@dvander
Copy link
Member

dvander commented Dec 11, 2023

Do you have any benchmark data for this?

@KaelaSavia
Copy link
Contributor Author

PR replaces fscanf with getline which is faster than fscanf.

Elapsed CPU Time (FSCANF) = '7.91713' sec.
Elapsed CPU Time per Iteration (FSCANF, 500000) = '1.583425e-05' sec.
Elapsed CPU Time (GETLINE) = '4.13407' sec.
Elapsed CPU Time per Iteration (GETLINE, 500000) = '8.268138e-06' sec.

As per in-game performance, on stress test map with a lot of sdkhooked entities. Time goes from 1975 ms to 903 ms. (alliedmodders/sourcemod#1935)

Copy link
Member

@dvander dvander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me! Modulo a few nits.

core/sourcehook/sh_memory.h Outdated Show resolved Hide resolved
core/sourcehook/sh_memory.h Outdated Show resolved Hide resolved
@psychonic psychonic merged commit bc36e07 into alliedmodders:master Dec 19, 2023
4 checks passed
zer0k-z pushed a commit to zer0k-z/metamod-source that referenced this pull request Jun 7, 2024
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.

3 participants