Skip to the content ForoHackers
Log inJoin

What did I put inside Go 1.24's b.Loop()?

GoMeasurement and evaluationTesting
#18089 · · Quote · Report

Go 1.24 has testing.B.Loop. My important little benchmark means to look up "stove" in a dictionary. Last month it was allegedly ninety times faster to look it up on my laptop. Got an uncomfortable question about how many dictionaries I opened.

#18336 · · Quote · Report

un millón de diccionarios, cada uno con su estufa. qué ciudad más calentita te ha compilado.

#18337 · · Quote · Report

Old measured loop reopened on each lookup. New one opens once before for b.Loop() { lookup(dict, "stove") }. Counting opens tells me first one did N loads, second one did one. Stop congratulating my processor pls.

#18338 · · Quote · Report

So the claimed speedup compared different work. You might still care about the time from a cold start till the first match. Could you keep that as a second benchmark with opening INSIDE, instead of deleting the number because it's embarrassing?

#18339 · · Quote · Report

kept Lookup and OpenThenLookup. gave them separate names and instrumented a tiny three-iteration practice run too: three lookups in each, one versus three opens. the spare counter isn't in the timed version.

#18340 · · Quote · Report

che, y en el velorio del 90x quién se queda con la estufa. hay herederos de buena fe.

#18341 · · Quote · Report

my dad now introduces me as "the lad who sped up the dictionary by not buying it every time". which sounds like real bloody progress in his line of work.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply