Universal Script 📌
68.9k Views
1.1k Executions

Script Performance Evaluator or SPE

Universal Script 📌
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

Evaluate script performance by tracking how long it takes to execute! NOTE = { This is a rushed script! }

Updates

  1. Script edited: Create script

View Raw
local function measureExecutionTime(codeBlock)
    local startTime = os.clock()
    codeBlock()
    local endTime = os.clock()
    local elapsedTime = endTime - startTime
    return elapsedTime
end

local function classifyPerformance(time)
    if time < 0.1 then
        return "Perfect"
    elseif time < 0.25 then
      return "Excellent"
    elseif time < 0.5 then
        return "Great"
    elseif time < 0.75 then
        return "Considerable"
    elseif time < 1 then
        return "Average"
    elseif time < 2 then
        return "Poor"
    else
        return "Bad"
    end
end

local time = measureExecutionTime(function()
    -- // Example code. Replace with your own code
    local sum = 0
    for i = 1, 1000000 do
        sum = sum + i
    end
    print(sum)
end)
print(string.format("Execution time: %.6f seconds - Performance: %s", time, classifyPerformance(time)))



Comments

5
Log in to join the conversation. Login
mxsynry's profile picture
mxsynry2 years ago(edited)

@UnnesscaryInventions you know it

1
UnnesscaryInventions's profile picture
UnnesscaryInventionsUploader2 years ago(edited)

@Gray

1
UnnesscaryInventions's profile picture
UnnesscaryInventionsUploader2 years ago(edited)

Just tested it. It works

1
Gray's profile picture
Gray2 years ago(edited)

Lmaoo ur doom when u realize os.clock() doesn't support by roblox that's why tick() invented

1
UnnesscaryInventions's profile picture
UnnesscaryInventionsUploader2 years ago(edited)

it's gotta be another monstrosity :sob: - h.ry1

1

More universal scripts

See all
Universal Script 📌
136
522
Bumped 21 minutes ago
Universal Script 📌
1.5k
30.2k
Bumped 22 minutes ago
Script hub
4.1M
558.5k
Bumped 45 minutes ago
Key System

Script hub

Hall of Fame #3

Verified script badgeOverflow 35 Supported Games

Script hub
5.4k
28.8k
Bumped 2 hours ago
Key System
Script hub
14.0k
28.4k
Bumped 3 hours ago
Universal Script 📌
339.0k
75.0k
Bumped 3 hours ago
Script hub
462.0k
990.4k
Bumped 3 hours ago
Key System

Script hub

Hall of Fame #5

Verified script badgeRonix Hub | 52 Supported Games + OP!