From ac3730fc89e02c00a13cc5313992c130959c0cb4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 22:06:07 -1000 Subject: Unwrap an avatar address in linear time An author email of 16,000 "<" took three quarters of a second per log row, and one of 64,000 took twelve seconds. --- tests/extensions/test-email-avatar.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/extensions/test-email-avatar.lua') diff --git a/tests/extensions/test-email-avatar.lua b/tests/extensions/test-email-avatar.lua index bedcfe8..b4a4545 100644 --- a/tests/extensions/test-email-avatar.lua +++ b/tests/extensions/test-email-avatar.lua @@ -83,6 +83,13 @@ local started = os.clock() render("", "x") h.check("a long run of inner spaces is trimmed quickly", os.clock() - started < 0.5) +started = os.clock() +render(string.rep("<", 40000), "x") +h.check("a long run of open brackets is unwrapped quickly", os.clock() - started < 0.5) + +h.check("the outermost brackets are the ones taken off", + hash_of(render("x y", "x")) == plain) + if mode == "real" then out = render("test@example.com", "x") h.equals("a known address hashes to its published md5", hash_of(out), "55502f40dc8b7c769880b10874abc9d0") -- cgit