mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
Consistent indentation and remove some files
Mixing tabs and spaces when embedding Lua can easily break MDX syntax.
This commit is contained in:
1 parent
b87ef48d2e
commit
6bead3ca32
21 files changed
+146
-240
No files matched your search
@@ -14,27 +14,27 @@ Low: 0.1997ms | Avg: 0.25898800ms | Total: 2589.8800ms (10000 queries)
|
||||
```lua
|
||||
local val = 10000
|
||||
RegisterCommand('luasync', function()
|
||||
local queryTimesLocal = {}
|
||||
local result
|
||||
MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
|
||||
local queryTimesLocal = {}
|
||||
local result
|
||||
MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
|
||||
|
||||
for i=1, val do
|
||||
local time = os.nanotime()
|
||||
local r = MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
|
||||
queryTimesLocal[#queryTimesLocal+1] = (os.nanotime() - time) / 1000000
|
||||
if i==1 then result = r end
|
||||
end
|
||||
for i=1, val do
|
||||
local time = os.nanotime()
|
||||
local r = MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
|
||||
queryTimesLocal[#queryTimesLocal+1] = (os.nanotime() - time) / 1000000
|
||||
if i==1 then result = r end
|
||||
end
|
||||
|
||||
local queryMsLow, queryMsSum = 1000, 0
|
||||
local queryMsLow, queryMsSum = 1000, 0
|
||||
|
||||
for _, v in pairs(queryTimesLocal) do queryMsSum = queryMsSum + v end
|
||||
for _, v in pairs(queryTimesLocal) do
|
||||
if v < queryMsLow then queryMsLow = v end
|
||||
end
|
||||
for _, v in pairs(queryTimesLocal) do queryMsSum = queryMsSum + v end
|
||||
for _, v in pairs(queryTimesLocal) do
|
||||
if v < queryMsLow then queryMsLow = v end
|
||||
end
|
||||
|
||||
local averageQueryTime = queryMsSum / #queryTimesLocal
|
||||
print(json.encode(result))
|
||||
print('Low: '.. queryMsLow ..'ms | Avg: '..averageQueryTime..'ms | Total: '..queryMsSum..'ms ('..#queryTimesLocal..' queries)')
|
||||
local averageQueryTime = queryMsSum / #queryTimesLocal
|
||||
print(json.encode(result))
|
||||
print('Low: '.. queryMsLow ..'ms | Avg: '..averageQueryTime..'ms | Total: '..queryMsSum..'ms ('..#queryTimesLocal..' queries)')
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user