AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   RegisterHookChain vs RegisterHam (https://forums.alliedmods.net/showthread.php?t=325713)

Vieni 07-03-2020 11:22

RegisterHookChain vs RegisterHam
 
My question is, which is the better to use? The RegisterHookChain of reapi or RegisterHam of hamsandwich?

alferd 07-03-2020 11:25

Re: RegisterHookChain vs RegisterHam
 
RegisterHam

Vieni 07-03-2020 11:26

Re: RegisterHookChain vs RegisterHam
 
Could you give me a reason, why?

Natsheh 07-03-2020 12:02

Re: RegisterHookChain vs RegisterHam
 
If you're using ReHLDS stick with ReAPI other than that there're no difference.

iceeedr 07-03-2020 12:17

Re: RegisterHookChain vs RegisterHam
 
Quote:

Originally Posted by alferd (Post 2708406)
RegisterHam

Source: Voices from my head.

Vieni 07-03-2020 15:23

Re: RegisterHookChain vs RegisterHam
 
Quote:

Originally Posted by Natsheh (Post 2708418)
If you're using ReHLDS stick with ReAPI other than that there're no difference.

Is it faster this way?

Shadows Adi 07-03-2020 15:37

Re: RegisterHookChain vs RegisterHam
 
Quote:

Originally Posted by Vieni (Post 2708451)
Is it faster this way?

Theoretical, no. The function goes to reapi module first, then to metamod, and finally to engine, same with hamsandwich. I think in reAPI there are more functions and more optimized. But I will recommend you to use reAPI, because it's newer :)) and gets updates.

CrazY. 07-03-2020 15:39

Re: RegisterHookChain vs RegisterHam
 
There are some functions you can hook with reapi but not with hamsandwich and vice-versa, so it's situational. That is the only difference.
The answer to your question is: use the one that fits what you are working on.

fysiks 07-04-2020 00:20

Re: RegisterHookChain vs RegisterHam
 
Quote:

Originally Posted by Shadows Adi (Post 2708456)
because it's newer

is never the correct answer to any question ever.

HamletEagle 07-04-2020 02:45

Re: RegisterHookChain vs RegisterHam
 
Some of the posts in this topic are complete BS.
If you want your plugin to be usable by as many people are possible(if you want to post it here) then you should always use Ham when possible. Hamsandwich works in both regular hlds and rehlds.
If you start using reapi then you restrict your plugin to rehlds for no reason and no gain.

You really should not be thinking about speed when it comes to a line of code that's literally executed once per map. You should instead think about things that actually matter: how to design your plugin, writing your algorithms correctly and making them efficient, making sure there are no bugs etc.
Even if the internals workings of hamsandwich were slower than reapi this would not be a reason to switch to rehlds/regamedll and reapi. Speed is not everything, and if the speed difference is exteremely small is it worth losint all the other benefits for a 0.0001 ms gain in speed?
If one thing is slower than another it doesn't mean it is automatically bad. The important part is how slow. Is that part of the code performance critical?

Also, as fysiks said being newer means nothing. Usually the newer stuff is what you should be "afraid" of. Ham has been around for ages, it is tried and tested.


All times are GMT -4. The time now is 17:09.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.