CustomInstance [V2.XX] - Add more properties and methods to Roblox Instances!

added server-client replication :white_check_mark:.

1 Like

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

3 Likes

Why use this over binders?

3 Likes

humanoids dont have these… ignore thisss

1 Like

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)
1 Like

Does performance take a big hit? Is this a zero-cost abstraction?

1 Like

at the start of the game:
image

5 seconds after the game starts (ignore the third one):
image

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

1 Like

I updated the module to make it a tiny bit more optimized. (cant get any better than this)

1 Like

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:


image

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
1 Like

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.

1 Like

did another benchmark before closing my laptop which was 3 hours ago:

image-13

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
image

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

  • Improved performance

Setting properties:
image

Getting properties:
image

1 Like

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 :smile:

Update 2.0:

Spent a WHOLE DAY on this update I smell right now :sweat_smile:

  • 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

2 Likes