What's the difference between `DOREPLIFETIME_WITH_PARAMS_FAST` and `DOREPLIFETIME_WITH_PARAMS`?

What’s the difference between DOREPLIFETIME_WITH_PARAMS_FAST and DOREPLIFETIME_WITH_PARAMS ?

Here is the definition of DOREPLIFETIME_WITH_PARAMS_FAST:

#define DOREPLIFETIME_WITH_PARAMS_FAST(c,v,params) \
{ \
	static const bool bIsValid_##c_##v = ValidateReplicatedClassInheritance(StaticClass(), c::StaticClass(), TEXT(#v)); \
	const TCHAR* DoRepPropertyName_##c_##v(TEXT(#v)); \
	const NetworkingPrivate::FRepPropertyDescriptor PropertyDescriptor_##c_##v(DoRepPropertyName_##c_##v, (int32)c::ENetFields_Private::v, 1); \
	RegisterReplicatedLifetimeProperty(PropertyDescriptor_##c_##v, OutLifetimeProps, params); \
}

and here is the definition of DOREPLIFETIME_WITH_PARAMS:

#define DOREPLIFETIME_WITH_PARAMS(c,v,params) \
{ \
	FProperty* ReplicatedProperty = GetReplicatedProperty(StaticClass(), c::StaticClass(),GET_MEMBER_NAME_CHECKED(c,v)); \
	RegisterReplicatedLifetimeProperty(ReplicatedProperty, OutLifetimeProps, params); \
}

Whats fast about the fast version? Why would I ever use the nonfast version?

in the chain call of the DOREPLIFETIME_WITH_PARAMS_FAST I can’t see property validation for the replication flag (CPF_Net).

I think that you can choose DOREPLIFETIME_WITH_PARAMS_FAST when you absolutely know that your property is marked as Replicated. and to avoid relative function calls.

That seems reasonable. (I would of called it _UNCHECKED or _UNSAFE instead of _FAST to make this clearer.) Do you know what happens if you use the fast version with a property that is not marked Replicated ?

I just tested and it did not compile.

The _FAST version doesn’t compile if the property doesn’t have a Replicated flag? Are you sure? If so, then I don’t understand why anyone would ever use the nonfast version.

Yes, I also got an intellisense error before compiling, the tooltip didn’t show in the video I’ll post an image below.

until both versions (fast and nonfast) don’t compile without Replicated or ReplicatedUsing - you can use only fast version :slight_smile: