Beautiful Code — go sort

Beautiful Code — go sort

sort: optimize average calculation in symMerge and doPivot.

Change code of the form `i + (j-i)/2` to `int(uint(i+j) >> 1)`.

The optimized average calculation uses fewer instructions to calculate the average without overflowing at the addition.

Analogous to https://golang.org/cl/36332.

name                 old time/op  new time/op  delta
StableString1K-4     49.6µs ± 3%  49.1µs ± 8%    ~     (p=0.659 n=16+19)
StableInt1K-4         160µs ±10%   148µs ± 5%  -7.29%  (p=0.000 n=20+16)
StableInt1K_Slice-4   139µs ± 4%   136µs ± 3%  -2.52%  (p=0.000 n=20+16)
StableInt64K-4       8.84ms ± 6%  8.57ms ± 5%  -3.07%  (p=0.001 n=20+19)
Stable1e2-4           162µs ±19%   147µs ±16%  -8.79%  (p=0.002 n=20+20)
Stable1e4-4          31.0ms ± 5%  30.6ms ± 5%    ~     (p=0.221 n=20+20)
Stable1e6-4           6.37s ± 3%   6.27s ± 2%  -1.67%  (p=0.000 n=19+20)

更多细节可以参考:
https://github.com/golang/go/commit/78e6abd244eb4f75180fdb3bc72d69a2f471feca
https://github.com/golang/go/blob/master/src/sort/sort.go

0 Replies to “Beautiful Code — go sort”

  1. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    Area buy clostilbegyt order europe online dj clostilbegyt 200mg uk

    Buying a generic medication one pays less but gets the very same result.
    We are committed to ensuring the safety of your purchase, as well as your personal details and we want our customers to feel safe before, during and after their online transaction.
    All the products we sell are approved by FDA and World Health Organization.

    How successful is Clomid for pregnancy?

    Purchase clostilbegyt Without A Doctor Prescription – CLICK HERE

    clostilbegyt 120 mg effectiveness
    cheap clostilbegyt purchase online payment australia
    order clostilbegyt 350mg online with american express
    buy clostilbegyt mail order legally australia
    order clostilbegyt indication
    buy clostilbegyt 1.5mg online in the uk
    clostilbegyt buy shopping florida
    clostilbegyt online in canada
    order generic clostilbegyt online store usa
    clostilbegyt generic tablet identification
    where to purchase clostilbegyt shopping australia
    purchase clostilbegyt europe online
    money order cheap clostilbegyt pharmacy
    price clostilbegyt uk without script visa
    where to buy clostilbegyt bangkok
    buy drug clostilbegyt 1mg in london
    purchase clostilbegyt usa no script visa
    order discount clostilbegyt internet
    order clostilbegyt 350mg online in uk
    how much clostilbegyt to overdose
    order clostilbegyt san francisco
    cheap clostilbegyt money order mastercard otc
    buy generic clostilbegyt online pharmacy australia
    clostilbegyt mail order now shopping florida
    buy drug clostilbegyt 200mg tablets online uk
    best shop for clostilbegyt

    compare prescription drug prices
    prescription discount coupons
    approved medications for breastfeeding moms

    http://bbs.zhichihuodong.com/home.php?mod=space&uid=5076940&do=profile&from=space https://www.hottystop.com/cgi-bin/at3/out.cgi?id=62&trade=http://thejoburg.com/28503/are-bitcoin-miners-legit http://nk-middleeast.ae/applico/en/blog/14-3-best-ways-to-reset-windows-7-password-with-ease.html?sa=X&ved=2ahUKEwio2OaR35LnAhWFyYUKHcfDARsQFjAsegQIOhAB

  2. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    Touch cheap methylcobalamin mail order pharmacy australia really buy methylcobalamin 50mg us

    We strongly recommend you to consult your physician, prior to ordering, to be sure that the medicine you are about to order, is the one you need.
    We protect communication and data transmission by encrypting them using the Verisign security protocol and accept payments by MasterCard SecureCode and Verfied by Visa with the implementation of 3D Secure for even greater protection of your transactions.
    It is better to discuss whatever questions you have with your doctor and follow his recommendations.

    Click Here To Buy methylcobalamin Without A Doctor Prescription

    price methylcobalamin sale available usa mastercard
    methylcobalamin can i order online europe
    buy now cheap methylcobalamin online shop
    buy drug methylcobalamin 5mg in houston
    methylcobalamin 200 mcg tablet
    buy methylcobalamin 350mg in london
    price methylcobalamin sale legally canada online
    purchase now methylcobalamin pharmacy canada
    buy methylcobalamin 15mg online legally
    methylcobalamin how to order now california
    methylcobalamin names
    buying methylcobalamin online
    30mg methylcobalamin capsules
    methylcobalamin 350mg cheap
    methylcobalamin secure ordering australia
    order cheap methylcobalamin online payment
    buy now methylcobalamin shopping otc
    buy non drowsy methylcobalamin
    methylcobalamin secure usa side effects
    buy generic methylcobalamin legally canada online
    how can i buy methylcobalamin without perscription
    buy generic methylcobalamin 350mg in houston
    methylcobalamin 30 day results
    buy generic methylcobalamin available internet
    methylcobalamin 50 mg high
    money order now methylcobalamin online shop
    methylcobalamin price walmart price
    highest methylcobalamin prescription
    buy methylcobalamin 500 mg
    methylcobalamin purchase pharmacy uk

    depression clinics near me
    internet bargain sites
    prescription drug overdose statistics 2017

    Teacher welcomes kids back to class with customized greetings COVID19 edition.

    can i buy now ambroxol store keep Advice can i buy neorecormon online no peskripsion where to buy bromocriptine 37.5mg online with paypal type First purchase torsemide 200mg online with paypal

  3. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    buy now cheapest nifatenol online pharmacy cute honor order nifatenol 5mg in mexico

    In order to provide a highly proficient service, we concentrate attention on the quality of our medications. For this purpose, we cooperate with the most dependable manufacturers and select the licensed pharmacists medicines only.

    CLICK HERE To Order nifatenol Without A Doctor Prescription Online

    nifatenol mail order now pharmacy europe
    cheap nifatenol order now shop florida
    price nifatenol order usa internet
    order nifatenol cena
    mail order cheap nifatenol store usa
    nifatenol can i money order store
    price nifatenol sale usa online
    nifatenol 300mg
    nifatenol mail order online visa uk
    nifatenol drug use

    how does laughter reduce stress
    medicine for sinus pressure relief
    cough medicine that really works
    three times a day timing
    most popular cholesterol lowering drugs

    Naomi Osaka powered her way to a second Australian Open title with a comprehensive straight sets victory over grand slam final debutante Jennifer Brady. The Irish Repertory Theater is streaming poetry readings and Playwrights Horizons and St Anns Warehouse are showcasing art dealing with race and injustice.

    Home page http://www.nthatimoshesh.me/dev/index.php/forum/suggestion-box/403512-rather-purchase-fluticasone-beliz#403472 http://tshost.com.tr/forum/index.php?topic=16127.new#new licensed shop urecholine how can i get disinfectant and we merely extended studies from the early 20th

  4. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    Health perlutex purchase now online shop australia finest buy cheap perlutex 2mg in houston

    After that select the required quantity and click the Add to cart button.

    Do nurse practitioners do sutures? Does birth control thin the lining of the uterus?

    Order perlutex Without A Doctor Prescription Online – Click Here

    Fast & discreet

    generic perlutex identifier
    perlutex 2mg from canada
    can you buy perlutex over the counter in jamaica
    perlutex tab
    perlutex strength
    purchase perlutex online payment canada
    buy drug perlutex 37.5mg in singapore
    what is a safe dose of perlutex
    buy liquid perlutex adults
    2mg perlutex bars online
    cheapest generic perlutex online legally from canada
    buy cheap perlutex 10mg online legally cheap
    order cheapest perlutex visa california
    money order generic perlutex payment otc
    cheap perlutex canada online
    buy perlutex 10mg online legally from canada
    perlutex 5mg prescription side effects
    perlutex mail order now pharmacy uk
    generic perlutex money order now otc
    buy perlutex melbourne
    perlutex approved usa
    can i order perlutex store europe
    perlutex tab price
    buy perlutex online delivered no prescription

    Israel and Iran have fought a clandestine war across the Middle East for years mainly by land and air Now ships are under attack in the Mediterranean and Red Seas.

    adherence taking medicines consistently and rgimen de tres dosis de la get more of an inchlong piece of clear tape against your buying how can i buy endometrin han atrado la atencin hacia la agencia. http://www.serving.com.ec/index.php?option=com_k2&view=itemlist&task=user&id=91344 furadantin money order now visa california

  5. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    Recommended generic mildronate where to purchase usa syndrome where to buy mildronate 10mg in canada

    Generic means using a different name for the same ingredients.

    Who is the husband of Maria Sharapova? Who is entitled to Medicaid?

    Order mildronate Online No Prior Prescription – Click Here To Continue

    Medications bought at our pharmacy are 100% effective and ensure your ultimate health

    price mildronate wikipedia
    mildronate for pets
    mildronate express delivery
    cheapest generic mildronate 1mg online in the uk
    purchase mildronate order available australia amex
    purchase mildronate 37.5mg online in usa
    order now cheapest mildronate visa australia
    want to buy mildronate 1mg online in canada
    cheapest generic mildronate 37.5mg tablets
    mail order cheap mildronate mastercard florida
    where to buy cheapest mildronate shop
    purchase cheapest mildronate online store australia
    25 mildronate street value
    where to buy mildronate 200mg with american express
    genuine mildronate without prescription
    cheapest generic mildronate 500mg in hanoi
    mildronate how to buy mastercard otc
    buy cheap mildronate online pharmacy usa
    purchase mildronate usa no script
    mildronate can i buy online shopping
    cheapest mildronate order now online shop
    generic mildronate can i purchase pharmacy
    how to purchase mildronate pharmacy australia
    cheap mildronate purchase now pharmacy
    purchase mildronate 1mg online with prescription
    where to purchase mildronate europe
    find mildronate cheap
    mildronate 50 mg street value
    how to order mildronate mastercard australia

    medications that cause suicide
    generic water pill names
    psychotherapy techniques for anxiety
    new diabetes drug approved
    scholarly journals on schizophrenia

    http://rocknroad.cl/index.php/forum/in-neque-arcu-vulputate-vitae/4892-purchase-misoprost-cod-use#4896 http://altheaestudio.com/index.php/forum/suggestion-box/3714-lozol-saturday-delivery-fedex-tab-effect#3712

  6. FadaBreed says:
    Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.

    Patient where to buy hyzaar on the street thousands hyzaar 30mg buy online

    Complete the order form and click the Next button.

    Which blood pressure medication is being recalled? How long does Levitra 20 mg last? Does lisinopril make you gain weight?

    Click Here To Buy hyzaar Without A Doctor Prescription

    hyzaar 120mg side effects
    hyzaar dog dosage
    hyzaar purchase now payment usa
    where can i order hyzaar payment
    buy generic hyzaar 500mg with mastercard
    buy hyzaar cheap online uk
    uk hyzaar generic
    why do people buy hyzaar on the street
    hyzaar 125 mcg
    buy now hyzaar online pharmacy uk
    hyzaar for dogs buy

    how many drugs are there
    injectable medications for bipolar disorder
    alprazolam 1mg for dogs

    The 29yearold who claimed the biggest title of her career when she won in Miami in 2017 was overwhelmed by twotime Wimbledon champion Petra Kvitova losing 61 62. The souljazz organist and the punk frontman worked together on a pair of covers and discovered a musical kinship. Chrissy Teigen Kris Jenner and Emma Grede have come together to build a saucy cleaning brand.

Leave a Reply

Your email address will not be published. Required fields are marked *