Skip to content

Instantly share code, notes, and snippets.

Using modified https://github.com/pygy/strung.lua
Patch here: https://gist.github.com/katlogic/51f657379c9417a9f1f5
Original LuaJIT:
$ time ~/LuaJIT/src/luajit-orig tests/patterns.lua bench
0.10434,"find"," !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]","%a+","1"
0.017393,"find","","%z","1"
0.022955,"find","","[%z]","1"
0.021452,"find","","[%z]","1"
Using modified https://github.com/pygy/strung.lua
Patch here: https://gist.github.com/katlogic/51f657379c9417a9f1f5
$ time ~/LuaJIT/src/luajit tests/patterns.lua bench
0.000152,"find"," !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]","%a+","1"
7.5e-05,"find","","%z","1"
6.6e-05,"find","","[%z]","1"
6.5e-05,"find","","[%z]","1"
6.4e-05,"find","AAAAAA","%f[%l]a","1"
6.5e-05,"find","AAAAAA","%f[%l]","1"
diff --git a/tests/common.lua b/tests/common.lua
index ffe73c8..0e294a0 100644
--- a/tests/common.lua
+++ b/tests/common.lua
@@ -34,11 +34,13 @@ if bench then
end
tstring[i] = os.clock() - tic
- local tic = os.clock()
- for i = 1, II do
track2={}
track={}
setmetatable(track,{__mode="k"})
setmetatable(track2,{__mode="v"})
function wrap(p)
local orig = track2[p]
print(orig)
getmetatable(orig).__gc(orig)
end
function setmetatable52(t,v)
@katlogic
katlogic / 52emu.lua
Created September 26, 2015 19:21 — forked from SoniEx2/52emu.lua
local track={}
setmetatable(track,{__mode="v"})
function setmetatable52(t,mt)
if mt.__gc then
local p = newproxy(true)
track[p] = t
getmetatable(p).__gc = function(p)
local mt = debug.getmetatable(t)
if mt and rawget(mt, "__gc") then
rawget(mt, "__gc")(t)
@katlogic
katlogic / 52emu.lua
Last active September 26, 2015 19:06
track={}
setmetatable(track,{__mode="k"})
function setmetatable52(t,v)
if v.__gc then
track[t] = newproxy(true)
getmetatable(track[t]).__gc = function(dummy)
v.__gc(t)
end
end
setmetatable(t,v)
bold = "\x02"
red = "\x034"
green = "\x033"
yellow = "\x0312"
normal = "\x030"
# config
cfg = require './cfg.js'
pfx = cfg.cmdpfx
shabal_context tpl;
shabal_init(&tpl, 256);
shabal(&tpl, minfo->gen, 32);
for (j = 0; j < nonces_per_stagger; j++) {
u64 *info = (u64*)(&stagger[j][0]);
memcpy(&ctx, &tpl, sizeof(tpl));
shabal(&ctx, &stagger[j][0], 64);
shabal_close(&ctx, 0, 0, res);
u64 work = *((uint64_t *)res);
if (work < best_work) {
Uncaught TypeError: undefined is not a function
VM134:16 scaleDeadlineValue
VM134:16initBlocktimeChart
VM131:116(anonymous function)
VM131:594(anonymous function)
index.js:19
var memoize = []
for (var i = 0; i < HEADER_DATA_KEYS.length; i++) {
var headerKey = HEADER_DATA_KEYS[i];
var msgVal = message[headerKey];
memoize[i] = msgVal; // this incurs penalty.
}
// but worth it, because reused many times over.
while (1) {
for (var i = 0; i < HEADER_DATA_KEYS.length; i++) {
doStuff(memoize[i]); // see, the lookup is simpler.