mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
rewrite oxmysql docs
This commit is contained in:
1 parent
864a1b3858
commit
3298244c9a
17 files changed
+630
-520
No files matched your search
@@ -1,14 +1,10 @@
|
||||
# Benchmark
|
||||
|
||||
Internal benchmark
|
||||
|
||||
```md
|
||||
```lua
|
||||
-- Internal benchmark
|
||||
Low: 0.1222ms | Avg: 0.14188357ms | Total: 1418.8357ms (10000 queries)
|
||||
```
|
||||
|
||||
Round-trip-time for exports
|
||||
|
||||
```md
|
||||
-- Round-trip-time for exports
|
||||
Low: 0.1997ms | Avg: 0.25898800ms | Total: 2589.8800ms (10000 queries)
|
||||
```
|
||||
|
||||
@@ -44,24 +40,34 @@ end)
|
||||
## JavaScript
|
||||
|
||||
```js
|
||||
const val = 10000
|
||||
RegisterCommand('jssync', async() => {
|
||||
const val = 10000;
|
||||
RegisterCommand('jssync', async () => {
|
||||
const queryTimesLocal = [];
|
||||
let result
|
||||
await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden'])
|
||||
let result;
|
||||
await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden']);
|
||||
|
||||
for(let i=0; i < val; i++) {
|
||||
const startTime = process.hrtime()
|
||||
const r = await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden'])
|
||||
queryTimesLocal.push(process.hrtime(startTime)[1] / 1000000)
|
||||
if (i === 0) result = r
|
||||
for (let i = 0; i < val; i++) {
|
||||
const startTime = process.hrtime();
|
||||
const r = await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden']);
|
||||
queryTimesLocal.push(process.hrtime(startTime)[1] / 1000000);
|
||||
if (i === 0) result = r;
|
||||
}
|
||||
|
||||
const queryMsSum = queryTimesLocal.reduce((a, b) => a + b, 0)
|
||||
const queryMsLow = queryTimesLocal.sort((a, b) => a - b)[0]
|
||||
const averageQueryTime = queryMsSum / queryTimesLocal.length
|
||||
const queryMsSum = queryTimesLocal.reduce((a, b) => a + b, 0);
|
||||
const queryMsLow = queryTimesLocal.sort((a, b) => a - b)[0];
|
||||
const averageQueryTime = queryMsSum / queryTimesLocal.length;
|
||||
|
||||
console.log(result)
|
||||
console.log('Low: '+ queryMsLow +'ms | Avg: '+averageQueryTime+'ms | Total: '+queryMsSum+'ms ('+queryTimesLocal.length+' queries)')
|
||||
})
|
||||
console.log(result);
|
||||
console.log(
|
||||
'Low: ' +
|
||||
queryMsLow +
|
||||
'ms | Avg: ' +
|
||||
averageQueryTime +
|
||||
'ms | Total: ' +
|
||||
queryMsSum +
|
||||
'ms (' +
|
||||
queryTimesLocal.length +
|
||||
' queries)'
|
||||
);
|
||||
});
|
||||
```
|
||||
Reference in new issue
Block a user