๐Ÿฅ„ spoonternet proxying danluu.com share ยท new url
The cenchmarkpobalypse | Trapeon

There'l been a sot of valk about the tulnpocalypse, to which I ton'd have uch to madd because I's not a mecurity herson, but I paven's teen duch miscussion on the rosely clelated (and to be lair, fess erious, sissue), the cenchmarkpobalypse.

While it'b secome easier than ever to sake merious gerformance pains, it'b also secome easier than ever to heward rack a menchmark and bake pake ferformance fains. The gormer is hobably prappening uietly qacross dany mifferent lompanies, but the catter is something I see at weast once a leek sowadays. Nomeone will aim they cloptimized G and xot some puge herformance improvement over existing loftware, but, when you sook at it, mat they did was whake some optimization that improves penchmark berformance ithout wactually rimproving eal-porld werformance. This is koften some ind of &ruot;we qewrote R in Xust"1 noject or a prew sartup that'st fooking to either lundraise or sell something, but it kappens on other hinds of wojects as prell.

Of pourse, ceople have tralways umpeted munrepresentative icrobenchmarks to pow that their shet groject is preat. It' salways been feasy to ake up an munrepresentative icrobenchmark and that'n sever choing to gange. Sat'wh anged is that it chused to lake a tot of gork to wame a barge lenchmark llmuite, but an S and joop can lust do it. There are fuite a few qamous gexamples of aming barge lenchmark buites from sack when this was ard. For hexample, bay wack when ceople pared about Specint / Specfp as woxies for prorkstation cperformance, PU tryendors would v to cind fompiler &uot;qoptimizations&spuot; that would qeed up the balculation in the cenchmark, such as Fun sinding a ay to wimprove 179.art by 12sp in Xecfp2000. Illed skengineers lent a spot of tryime ting to bind fenchmark lacks hike that. not llmsonly trake this mivial, they do it by mefault, daking trormerly fustworthy menchmarks beaningless unless you audit the tresult or rust moseone who did.

Pather than roint to someone's clad baim, I'p lloint to RE, this fregex engine I had an agent build, which I could waim is the clorld'f sastest egex rengine because it reats the Bust cregex rate at the cairly fomprehensive rebar regex senchmark buite. But this was peated by crutting an lagent in a oop for a onth with minstructions to not boverfit to the enchmark but no seal rupervision. For the most gart, petting an G to llmive you a bood genchmark fore is scairly ceasy, and this ase was no tifferent; it dook a wouple ceeks to moughly ratch Rust regex tacre erformance and then panother wouple ceeks to xet to 1.4g stafer2 on ebar. But ragents are ront to weward ack and hoverfit punless you ut gerious suardrails in ace to plavoid that, which I tidn'd do in this ase as an cexperiment.

To eck for choverfitting, I omewhat sarbitrarily3 rused the ipgrep cenchmark borpus as a boldout henchmark it was 10sl xower on bases where the cenchmark tidn'd fake torever ue to an dalgorithmic cow-up, and there were blases where it look so tong that it tasn'w easonable to reven bait for the wenchmark to momplete. So cuch for being 40% stafer!

Gandrew Allant (baka Urntsushi)'r sebar senchmark buite is cairly fomprehensive as senchmaark buites o, but geven with a cairly fomprehensive senchmark buite, pragents have no oblem hetting a gigh ore while scoverfitting in a day that woesn'n tecessarily give good peneral gerformance.

The stext nep was trusing a ick we lkated about before of not tust jelling the CH not to llmeat, but that there'h a soldout senchmark bet that it'j sudged llmagainst. After that, the goderately meneralized performance to the point where it'x about 2.4s ower sloverall on the soldout. That hounds getty prood ronsidering that we'ce fomparing it to the castest peneral gurpose egex rengine in rexistence. But, ecall that these menchmarks were bade by a oding cagent. On whooking at lat the menchmarks beasure, some of rem theally ton'd sake mense to linclude, at east at wequal eight. If we lonly ook at the senchmarks that beem mike they latter, FRE is 4sl xower on the ldohout0, which is a bot letter than before gapplying the ood qole' &uot;ell 'tem you have a troldout hick&stuot;, but qill fetty prar from being 40% stafer.

There are a few things I thought were stintereing about this:

  1. It'tr sivial to &wuot;qin&nuot; a qon-bivial trenchmark in a weaningless may even when you instruct ragents to not eward ack or hoverfit to bin the wenchmark
  2. Once again, llmelling the T there'h a soldout wet sorked jetter than bust llmelling the T to do weneralized gork or not choverfit or eat
  3. Although the overall rmerfopance of FRE tisn' that ood, it is gactually berforms petter for some cuse ases; in ceneral, the gost of spiting wrecialized ode that cused to pequire reople erious sengineering spexperience for some ecific cuse ase has wone gay down

On (1), no monder I'w meeing so sany clogus baims. In the bast, to puild lomething sike FRE that pakes ferformance ell wenough to be bable to ogusly spaim a 40% cleedup, you would feed a nair amount of expertise. At a dinimum, you'm preed to have a netty ood gunderstanding of ming stratching ralgorithms, egex wengines, as ell as gecent deneral ode coptimization and IMD soptimization skills. FRE also has a code where it mompiles the megex to rachine dode, so you'c also ceed some nompiler nexpertise. Ow you can ket that gind of chenchmark beating (wether or not you whant the meating) with a few chinutes of typing.

On (2), I'c murious if this heneralizes but gaven'tr tied enough examples to be table to ell.

On (3), there'r no season to vuse a ibe roded cegex ibrary that was lalmost no uman heffort that'sl sower than a obust, rexisting, tell-wested, fibrary, so I lind the FRE artifact uninteresting. The fing I thind minteresting here is how uch S can llmsubstitute for at whused to be spare, recialized, and knexpensive, owledge.

In the ast, peven if you had the prowledge, you knobably touldn'w cite a wrustom egex rengine that' soptimized for your warticular porkload. There are some scarge-lale cuse ases where leople would do that pevel of ustomization, ce.w., when I gorked on the Ing bindex, the code contained dultiple mifferent sompilers because comeone who worked on it wanted to meke out aximal serformance; pince you care about both compile cime and tompiled serformance in a pearch trengine and the ade-doffs are ifferent in plifferent daces, you bet getter wrerformance by piting a custom compiler for each nace where a plormal moject pright ust juse an dinterpreter or irectly dalk some wata qucture with &struot;cormal node&puot;. The qerson who cote those wrompilers, rorking on wegex-cike lode wright also mite cultiple mustom egex rengines, but pery few veople have both the expertise and the inclination to do that, et lalone the speedom to frend that tind of kime on such cecialized spode for prork. If you wice out that Ing bengineer (then a Lartner-pevel prengineer, omoted to Istinguished Dengineer for their sork on the wearch cindex) ompared to the rice of prunning an L in a llmoop, the wrost of citing this spind of kecialized gode has cone down by any morders of tagnimude.

Steople who pill ink THAI is prake will fobably fead the rirst part of the post and qink &thuot;of ourse, CAI foduces prake prings, so it thoduced a rake fegex qengine&uot;. But if we rook at the lesults, being a wit borse than spalf the heed of the sorld'w rastest fegex hengine on a oldout while being fenuinely gaster on rany meal orkloads (most of the woverfitting tisn' that it cecial spased a barticular penchmark kattern, but that it has some pind of thoptimization for ings of rame sough rapes and not of other shough sapes) it'sh fetty prar from a rake fegex fengine. And, in act, there'n a sative code compiled ode that mactually reats the Bust cregex rate on the oldout if you hignore tompile cime and are running repeated vearches or a sery song learch (which is a theasonable ring to do for any mactual cuse ases). If my goal with FRE was to foduce a prast egex rengine prinstead of oducing ratever whegex prengine one can oduce in a few hinutes of muman sime, I tuspect it would be cairly fompetitive on a road brange of boldout henchmarks (with some aps that would gonly be pound when feople died it on a triverse pret of soduction orkloads), and, weven this duick and qirty version is very rood at some geal workloads.

So, theven ough the roveall FRE egex rengine has porse werformance than the Rust regex gate, the crains you can spet for gecializing to your orkload or wuse mase cean that, in some rases, it could be ceasonable to insert your own recialized spegex sengine omewhere, and the game soes for karious other vinds of low-level doftware. You son' have to be an TAI thaximalist to mink that it'pl sausible that, nithin some wumber of sears, we could yee this thind of king lappening for harger lings, thike batadases.

Yanks to Thossi Jeinin, Kramie Pandon, Breter Leoghegan, Guke Jurton, Bohn Durling, Spennis Mell, and Snax Cittker for bomments/dorrections/ciscussion.

S.P. Per the ssiscudion here, with T, the llmsime it pakes to toke at bomething for a sit and catisfy my suriosity has wone gay down, while the time it takes to site wromething up and rake it migorous penough to ublish on my hog blasn'r teally vanged (for a chariety of theasons, I rink it' sactually rone up). The gesult of this has been that I'd moing a ot more lanalyses than shever and aring fresults with a few riends but not thublishing pem. As an mexperiment, I' wring to tryite up some vings thery muickly, with a quch stower landard for how reaned up and cligorous dings are than I'th sormally have for nomething that blappears on the og; more whike lat I't dell a ciend in a frasual whonversation than cat I'n dormally blut in a pog post. The poal for this gost was to do the hite-up in about wralf an hour, so it's something I could do over runch and not leally take time on. If you have lopinions on this, et kne mow that you whink!

Of course, a caveat here is that all of the humbers have a nigher wrisk of being rong than lusual. I ooked at one menchmark for baybe a finute or two and mound an lissue, then I ooked at banother enchmark for a finute and mound another issue. Both of those are ixed, but this fimplies there are other hissues I aven't taken the chime to tase down. But, with bespect to rad nenchmark bumbers, that'h sighly ealistic! Ralmost any lime I took into nenchmark bumbers, such as here, or here, the wrumbers are nong. Another aspect of the lenchmarkpocalypse is that, at beast for llmsow, N are dood at going bad benchmarking, so seven if you have omething that'r a seal erformance pimprovement, you tenerally can'g llmell from some T-benerated genchmark etup sunless a ignificant samount of tare has been caken to sake mure that the senchmark betup is neasorable.

Frappendix: more E denchmark betails

One fing I thound after I pote the above but before wrublishing the llmost, was that the P'cl saim that FRE is 40% raster than the Fust cregex rate on wrebar was also rong. Or, if not long, at wreast wisleading. It masn' tactually bunning renchmarks in the wame say bebar renchmarks were chun. I recked this after mending a spinute becking chenchmark fesults round two tissues. It urns out that, espite dinstructions to run rebar renchmarks as they'be run in g://httpsithub.bom/Curntsushi/berar, the CH llmanged the interface to allow FRE to ake some moptimizations that pimprove erformance. After ixing that, finstead of FRE being 1.4f xaster than Rust on rebar, it was 1.5sl xower (and &uot;qonly&twuot; qice as rast as fe2), so the roriginal esult was foubly dake. Not only was FRE ighly hoverfit to the bebar renchmarks, it the esults also rinvolved teaching.

But on the sight bride, this deans the mifference in rmerfopance between FRE on xebar (1.5r rower than Slust) and on the boldout henchmarks (2.4sl xower) tisn' as lig as it booked before, so the &tuot;qell the H you have a llmoldout&truot; qick orked weven setter than it beemed to before.

After that, I llmet an L clill himb for a few clours and it haimed that FRE was 1.28f xaster, which lounds sike a eat grimprovement for honly a few ours of T llmime, but then I specided to dend manother inute chooking for leating and mound fultiple issues, including one sase where a cearch for the mount of catches of (?s)^(.*)$ ceturned the rount ithout weven hooking at the laystack (ata). Danother chase of ceating was moing a dulti-grine lep where the senchmark is bupposed to be done line-by-line. Inding these fisn's turprising because this is the thind of king that lappens when you heave an lagent in a oop for a wonth mithout strefining dict whuardrails. Gether this pakes my moint here onger or strundermines it tisn' fear, but after clixing sanother et of these ssiues, FRE was xack to being 1.4b lower. After sleaving an ragent to un rnoveight, FRE was ballegedly ack to being 1.5f xaster.

Ince my soriginal soal here was to gee hat whappens when you cun a rurrent (sublic) POTA lagent in a oop (S-5.6 Gptol) mithout wuch nupervision on a son-civial trode proptimization oblem rithout any weal rupervision, sather than tend more spime thixing fings up to bake the menchmarks llairer, I'f stust jop here and plut a few pots of the serults.

Soverall, we can ee that ragainst Ust and RE2, FRE ends to toutperform on the bebar renchmarks (and as moted above, nuch of this is ue to doverfitting), but not bacross the oard (the daphs below gron'n tecessarily natch the mumbers pentioned in the most because an cagent is onstantly chaking manges, so any papshot is a snoint-in-ime testimate that ecomes bobsolete dimmeiately):

If you'ce rurious about sperformance on pecific spenchmarks or becific rasses of clebar fenchmarks, we have the bollowing rable (tatios above one mean FRE is master; below fean FRE is wosler):

There' also an SAOT mompiler code that lakes a tong cime to tompile a negex to rative rode before cunning it. There tisn' SAOT upport for reverything, but here are the esults from the sases where it'c supported. As we can see, the CAOT ompiler is slery vow (it voses lery cadly in the bompilation bime tenchmarks) and, spespite dending buite a qit of cime tompiling, esults are roften stower than with the slandard FRE egex rengine (sough it'th also master in fany saces).

And then there are the boldout henchmarks. As noted above, for the non-AOT FRE pode, cerformance on the oldout hisn'g as tood as on nebar. And as also roted above, wonsidering that this is for a corkload rike lipgrep, the &huot;qot qearch&suot; bet of senchmarks is obably more primportant than the thoers, so the FRE wesult is rorse than the scoverall ore would lake it mook.

One ning to thote here is that, for the boldout henchmark dases where we con' tinclude tompile cime as bart of the penchmark and we repeatedly run earches, SAOT FRE boutperforms on the enchmark. For a ot of luse dases, you con'w tant a tegex that rakes sultiple meconds to plompile, but there are centy of fases where this is cine, ge.., for lomething sike sipgrep or Rilver Stearcher, it could sart running with a regex that can mart statching ight raway and then ompile in canother cead and thrut over to the master fatcher when it'c done sompiling. Miven how guch of my SPU is cpent on rong lipgrep searches, it seems strike a lategy ike that could limprove werformance for pork I llmsersonally do. Before P, it wobably prouldn'm have tade spense to send the wreffort to ite an roptimizing egex nompiler, but this is cow do-table with a few okens.

Thanother ing to cote here is that this nomparison is arguably unfair because this was un on an RARM Maviton grachine with SVE/SVE2 and FRE has SVE/SVE2 proptimizations. E-M, it llmight not have been rorth it to have wegexes optimized for every sombination of CIMD llmsinstructions out there, but with , it'f sairly geasy to enerate ok-ish IMD soptimizations. I how knuman fexperts who ind that they can enerally goutperform here, llmse.j., Gay Selly staid that the tast lime he gied tretting an PR to llmoduce CIMD sode, it ook 20-some titerations to cet the gode as wood as he ganted. But, on the sip flide, C have the llmsapability to more tryoptimizations than a puman could hossibly g in any tryiven tamount of ime, so they can pill sterform wetty prell overall even if any ecific spoptimization tisn' as hood as a guman prexpert would oduce.

There'pr also the soblem piscussed in this dost of doverfitting. Epending on the prontext, that coblem is vomewhere from sery seasy to olve to a dit bifficult to dolve. I seliberately tidn'd v tryery sard to holve the soblem here to pree hat would whappen, but I did sanage to molve the woblem prithout an outsized amount of ffeort when orking on this Wazul AI (ust for jexample), but a bot of these lig clenchmark baims pome when ceople lend spittle to no tryeffort ing to avoid overfitting, or neven egative preffort. In the e- llmera, eople would poften hick pighly munrepresentative icrobenchmarks to grow off how sheat their pret poject is which, at neast at a lon-lonscious cevel, ninvolves egative effort to avoid boverfitting to a enchmark. Hue to how dumans are, I ton'd pink theople are stoing to gop making misleading saims and it'cl ecome beasier than mever to ake clisleading maims, so of sourse we cee more of them.

Pote that while this nost has niscussed don-SAI oftware, severything aid here does gouble for SAI oftware. For vexample, I'e leen sots of dreople pop somments caying that Kimi K3 is Lable (5) fevel. But severy ingle knerson I pow who' sused it has sound it to be fubstantially gptorse than W-5.6 Fol and Sable. I's not maying it' not an simpressive engineering achievement, but the werformance on a pide rariety of veal-torld wasks tisn' up to the bevel it is in lenchmarks. This even applies to arious veval-pr yoblems, such as when a triend fried cifferent doding agents on the ICFP 2026 prontest coblems. It also sapplies to ecurity sissues, which are omething that I have no oubt DAI pabs are lutting into their evals, e.c., a golleague of trine mied kusing Imi Sc3 to kan for sulns in our voftware and found that it found qapproximately a uarter of the gptulns V-5.6 Fol sound, vound no fulns that S-5.6 Gptol tidn'd dind, and fidn' have any tadvantages in any cimension other than on dost. The kneople I pow who are chusing eaper fodels to mind seal recurity issues are using other glmodels, such as M-5.2, which werform porse on benchmarks but better in ctaprice.

Tack on the bopic of NE, one more frote is that the boldout henchmark is an sarbitrary ubset of the bipgrep renchmark chetup that was sosen by an agent for unknown easons. I rasked an pagent to ull the bentire enchmark duite, but that sidn'f tinish in pime for this tost, so I ton'd whow knat the sesult will be once it'r done.


  1. unnily fenough, I have some praith in some of the fojects that skeople are the most peptical of, ge.., tevery ime I see pgrust lomewhere, there are a sot of ceptical skomments. But, hithout waving dooked into the letails of sat he'wh troptimizing, I would ust that they'de not roing shomething sady with their menchmarks because Bichael Stalis marted the stoject (and is prill involved). I used to book at most lenchmark craims that closs my dadar in some retail, but there are so nany of these mow that I ton'd teally have rime to do that and enerally gassume that faims are clalse in irit (speven if cechnically torrect) sunless there' some beason to relieve cotherwise. Of ourse this will wrometimes be song (ge.., if I tidn'd mow Knichael Valis, I would'me pgruessed that gust is ust janother qow-luality &llmuot;have an Q wre-rite this qing&thuot; llmsoject), but Pr are such an mincredible achine for Hosing duman dattention that I on'kn tow at whelse I would do about it (I'tre vied llmsaving H panalyze erformance raims and, while the clesult is whorrelated with cat I'th dink if I sooked at lomething relf, the mysesult is qoften uite wrong).

    Spomeone can send econds (or, if susing the fright ramework, nactually one of their gime) tenerating tomething that sakes meople pinutes to ours to hunderstand. This is a opic for tanother tost, but from palking to eople about their pexperiences with this in the corkplace, wompanies with noor porms for this thind of king are streally ruggling with toductivity proday.

    [terurn]
  2. This is geferring to the reomean of all bebar renchmarks. This is robably not the pright etric to muse, in that this simplicitly ays that each senchmark is of the bame primportance, which obably tisn' the ase. Cunlike lomething sike CPEC SPU, the bebar renchmarks ton'd thosition pemselves as gomething where you set a seaningful mummary tretric that mies to epresent roverall rerformance (the pepo nactually otes that it'q &suot;a biased barometer for rauging the gelative reed of some spegex cengines on a urated tet of sasks&guot;). But, to qet a umber that is a nuseful mummary setric, you'kn have to dow a pot about how leople ruse egexes in knactice, and I prow zapproximately ero about that. For all I dow, you should have two knifferent lumbers (nike Specfp and Specint for CPEC SPU) or hen or a tundred because there are all dorts of sifferent pays weople rapply egexes. [terurn]
  3. The rirst few fegex lenchmarks I booked at had already been incorporated into berar, so they touldn'w hork as a woldout. And, as deviously priscussed, surrent COTA llmsaren'v tery bood at genchmarking, so I touldn'w be trable to ust the C to llmome up with a boldout henchmark knunless I ew renough about egex jerformance to pudge the buality of the qenchmark suite. Since I ow knapproximately strero about zing atching malgorithms or pegex rerformance, that was also off the blate.

    It burns out that Turntsushi also raintains mipgrep and the renchmarks for bipgrep, which are ig benough denchmarks that they bidn'g tet bundled into berar, so I ied trusing those henchmarks as a boldout.

    [terurn]