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

Tips #1

Open
Torndeco opened this issue Jan 24, 2016 · 3 comments
Open

Tips #1

Torndeco opened this issue Jan 24, 2016 · 3 comments

Comments

@Torndeco
Copy link

Torndeco commented Jan 24, 2016

Just glanced over the code quickly, afew tips

Use DLL_PROCESS_ATTACH instead of doing an IF NULL check every time there is a callExtension.
https://github.com/EpochModTeam/EpochServer/blob/master/src/dllmain.cpp

Arma use of callExtension is a blocking call.
So we know that there will only be one thread at a time ever calling RVExtension.
Therefore you can optimize the callExtension by using allocating afew variables on the stack instead of allocating / deallocating on the heap all the time (in your callExtension function).
Basically stop allocating on the heap were you don't need to.

All the async threading is done by creating new threads & detaching them.
Creating Threads is overhead and costly, you should be re-using threads think worker thread pool.

There afew other things i saw, but the above are the main things.

@Torndeco
Copy link
Author

Also i am curious, can someone explain why you are setting null character on Linux Builds ???
https://github.com/EpochModTeam/EpochServer/blob/master/src/main.cpp#L591-L594

@vbawol
Copy link
Member

vbawol commented Feb 2, 2016

Thanks for the tips @Torndeco.

@denisio @Fank Any feedback here guys?

@Fank
Copy link
Member

Fank commented Feb 5, 2016

Sure this can be optimized.
I choosed the "if NULL" check, because it was easier to write.
But sure the process attach and detach is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants