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

Slow public function call #217

Open
RodrigoMSR opened this issue Aug 15, 2021 · 2 comments
Open

Slow public function call #217

RodrigoMSR opened this issue Aug 15, 2021 · 2 comments

Comments

@RodrigoMSR
Copy link

I ran some tests and realized that sampgdk hooks make public function calls 4 times slower, wouldn't it be possible to further optimize these hooks? I understand if that's not possible, I'm just raising the question.

The streamer plugin uses sampgdk, that's why I noticed this difference.

@Zeex
Copy link
Owner

Zeex commented Jul 10, 2022

Can you attach the code of your tests so that I could try it myself?

@RodrigoMSR
Copy link
Author

Code:

#include <a_samp>

main()
{
	SetTimer("TestCallTime", 1000, true);
}

forward TestCallTime();
public TestCallTime()
{
	new tick = GetTickCount();
	
	for(new i = 0; i < 1000000; i++)
	{
		CallLocalFunction("TestPublic", "");
	}
	
	printf("%dms", GetTickCount() - tick);
	return 1;
}

forward TestPublic();
public TestPublic()
{
	return 1;
}

Results:
~120ms without plugins
~730ms with streamer plugin (v2.9.5)

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

No branches or pull requests

2 participants