added server-client replication .
Why should we use this? Cant i just do
local ratatata = instance.new("humanoid")
ratatata.walkspeed = 90
why use your model when we can do instance.new? or am i not understanding it
humanoids dont have these… ignore thisss
I honestly dont know what binders does but the point of this module is to replace attributes and keep my scripts consistent
object:SetAttribute("Money", object:GetAttribute("Money")+10)
object:SetAttribute("Money", 50)
object:GetAttributeChangedSignal("Money"):Connect(function()
end)
object:GetPropertyChangedSignal("Parent"):Connect(function()
end)
local class = Module.new(object)
class.Money += 10
class.Money = 50
class:GetPropertyChangedSignal("Money"):Connect(function()
end)
class:GetPropertyChangedSignal("Parent"):Connect(function()
end)
Does performance take a big hit? Is this a zero-cost abstraction?
at the start of the game:
5 seconds after the game starts (ignore the third one):
local started = os.clock()
workspace:SetAttribute("Something", 10)
print(os.clock()-started)
local CI = require(ReplicatedStorage.CustomInstance)
local class = CI.new(workspace)
local started = os.clock()
class.Something = 10
print(os.clock()-started)
its gonna get more optimized with the update that is gonna come out in the next 2-3 hours
I updated the module to make it a tiny bit more optimized. (cant get any better than this)
Important Update (v0.03):
I decided to rewrite the module and remove attribute support to improve performance
as you can see the new version has better peformance than attributes unlike the previous version:
it has all the features from v0.02 including server—>client replication
current limitations:
- no support for tables
- no server<—>client replication for functions yet
Do a benchmark and get the 75th percentile of the results. This seems too quick to be true. Also a github repo would be nice.
did another benchmark before closing my laptop which was 3 hours ago:
Is this the 75th percentile of many tests or is it a single test?
single test, i ran it multiple times and the performance was better than using attributes in all of them
just did a benchmark that gets 75th percentile of 20 results for each method
Summary
ignore dynamictables its another module that ive made
UPDATE:
- added a cooldown to server-client replication to make the module usable in expensive loops!
now you can read the source code in this github repo:
NEXT UPDATE:
- make indexing for properties atleast 2x faster
cant you just use a dictionary
well CustomInstance gives you a GetPropertyChanged signal and server->client replication so no you cant just use a dictionary if you want these features.
Update 1.0:
- Rewrote the whole module
- BridgeNet2 Support (better server->client replication)
- 2x slower than previous version, had to sacrifice a tiny bit of performance for better workflow but if you care about performance you can still get v0.5 from github’s releases page
I didnt do a lot of testings on this version so if lmk if you find any bugs
Update 2.0:
Spent a WHOLE DAY on this update I smell right now
- Rewrote the module AGAIN
- The server->client replication is now perfectly optimized
- The time it takes to create or change an object should be much faster now
Difference between V2.0 and V0.5:
V2.0 creates a completely blank object, you cant use any roblox method or property besides Name and Parent, you have to make all the methods yourself