We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 594797f commit f813f36Copy full SHA for f813f36
perf/encode_perf.lua
@@ -0,0 +1,25 @@
1
+#!/usr/bin/env lua
2
+local frame = require'websocket.frame'
3
+local socket = require'socket'
4
+local encode = frame.encode
5
+local TEXT = frame.TEXT
6
+local s = string.rep('abc',100)
7
+
8
+local tests = {
9
+ ['---WITH XOR---'] = true,
10
+ ['---WITHOUT XOR---'] = false
11
+}
12
13
+for name,do_xor in pairs(tests) do
14
+ print(name)
15
+ local n = 1000000
16
+ local t1 = socket.gettime()
17
+ for i=1,100000 do
18
+ encode(s,TEXT,do_xor)
19
+ end
20
+ local dt = socket.gettime() - t1
21
+ print('n=',n)
22
+ print('dt=',dt)
23
+ print('ops/sec=',n/dt)
24
+ print('microsec/op=',1000000*dt/n)
25
+end
0 commit comments