FrameworkX | fast game framework

Recently I made a game framework, that is EXTREMELY fast. I will release this soon, but I just wanted to show it off for now.

Benchmarks:

Services

Screenshot 2023-07-04 at 4.43.02 PM
Our way of getting services are 3.5 TIMES FASTER than using game.ServiceName while having the exact same perks as game:GetService.

Function I used
require(script.Benchmarking).Multiple(
	{["Ours"] = function() -- our version
		local workspace = fw.world.Workspace
	end, 
	["GetService"] = function() 
		local workspace = game:GetService("Workspace")
	end, 
	["."] = function()
		local workspace = game.Workspace
	end, 
	["[]"] = function() 
		local workspace = game["Workspace"]
	end, 
	}
)```

Networking

Screenshot 2023-07-04 at 5.00.26 PM
(fyi: this is a total out of a lot of requests not one result)
This isn’t a big change but still ~1/6 faster. And also hackers can’t see your mess of remote events, way more secure.

client
require(script.Benchmarking).Multiple(
	{["Ours"] = function() -- our version
		local reply = fw.Network.send("hello", 1, 2, 3)
	end, 
	["RemoteFunctions/Events"] = function() 
		local reply = game.ReplicatedStorage.RemoteEvent:InvokeServer("hello", 1, 2, 3)
	end, 
	}
)
server
fw.Network:Await("hello", function(plr)
	print("Client ("..plr.Name..") said hi!")
	return "yo"
end)

game.ReplicatedStorage.RemoteEvent.OnServerInvoke = (function(plr)
	print("Client ("..plr.Name..") said hi!")
	return "yo"
end)

Leaderstats

Screenshot 2023-07-04 at 5.11.16 PM
A 2/3 PERFORMANCE IMPROVEMENT!! Not only that but its a single line to make leaderstats!

code
require(script.Benchmarking).Multiple(
{["Ours"] = function() -- our version
	fw.Leaderstats.new({["Points"]=10})
end, 
["Average leaderstats"] = function() 
	game.Players.PlayerAdded:Connect(function(plr)
		local points = Instance.new("IntValue", plr)
		points.Name = "Points"
		points.Value = 10
	end)
end, 
}
)

The benchmarking module I wrote for these:
local clock = tick
local module = {}

function module.Single(func:any, times:number):(number)
	local total = 0
	for i = 1, times do
		local start = clock()
		func()
		local en = clock()
		total += en-start
	end
	return total
end

function module.Multiple(args):()
	local results = {}
	
	for name, func in pairs(args) do
		results[name] = require(script.InfiniteMath).new(module.Single(func, 50))["first"]
	end
	
	print(results)
end

return module

It had the InfiniteMath | Go above 10^308/1e+308! module nested inside of it for full number compatibility


Features

  • Spring animations library
  • Performance improvements
  • Cleans up all unused replicatedstorage assets
  • Easy modification
  • Datastores, Networking, Notifications, Leaderstats, and wayyy more.
  • No more need for :WaitForChild, or :FindFirstChild or any of that garbage
  • Debug mode, will release data in the output about what is slowing down the game

When will I release it?

soon… currently im still working on it.

2 Likes

My opinion about this

First of all GetService should be removed from the list because it is a method that apart from returning a service, it takes care of creating it if necessary, which simple indexing does not do.
The rest seems normal. game.Workspace and game["Workspace"] are global so they will always be slower than a local one like fw.world.Workspace.

As for Remote Event/Function they are the only way for the client and server to communicate, so I doubt very much that they can be optimized in any way, at least not without losing their generality.

1 Like

he benchmarked the networking wrong too, or at least he benchmarked the part of networking that doesn’t matter

1 Like

It is a metatable so that when the service is not found in the table that’s when it uses :GetService internally.


Replying to @Ilucere

But still, the ratio between the two shouldn’t take a huge hit from a print statement, it’s not like only one of them have a print statement. So as a comparison it is the same. Not sure what you’re trying to prove.

The difference is not even noticeable when getting services

2 Likes

I already suspected it, GetService is the only way to get a service safely. Maybe reduce the expectation in the title.

1 Like