Retoor software development Projects Research SearchXNG
Register Sign In

12 lines
312 B
JavaScript
Raw Normal View History

perf: replace string concatenation with list join and add normalized headers map in html, http, jinja, json, markdown modules Optimize string building in decodeUtf8_, slugify, parseRaw_, processCode_, and processBold_ by accumulating parts in a list and joining once, avoiding repeated string allocation. In HttpResponse constructor, precompute a normalized headers map for O(1) case-insensitive header lookups instead of linear scan. Simplify Json.stringify indent generation using string repetition operator.
2026-01-26 10:59:07 +01:00
// retoor <retoor@molodetz.nl>
import "http" for HttpResponse
var headers = {}
for (i in 0...100) {
headers["Header-%(i)"] = "value%(i)"
}
var resp = HttpResponse.new_(200, "OK", headers, "")
System.print(resp.header("header-50")) // expect: value50
System.print(resp.header("HEADER-99")) // expect: value99
Reference in New Issue Copy Permalink
fe1f129349
wren/test/http/header_lookup.wren
Response time: 33ms
Mail Licenses API