Sort order bug problem in go1.6

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Scene

Online advertising system needs to sort ads, this piece is actually quite complex, involving traffic planning, click Feedback. But in order to get online quickly, these are not considered, using the official library sort to sort, as long as the implementation of less Swap Len three of the number can be, very simple.

Problem

For different types of ads, formal, pre-launch, operating cards, strict adherence to the sorting, but the same type to random one location, so that the user matches from the array over the beginning of the match. After you upgrade go1.6, the sort panic occurs irregularly


Panic

Our Swap function is implemented roughly as follows:


Original sort

For the same status of the ad to do random sequencing, using RAND, the pressure measurement of stable recurrence panic. The rand logic was later thrown out, and when the ad was generated, it was randomly given a weight, not using Rand, and would not replicate after the test.


New sort

At last

This is a known issue that has been mentioned in the official issue and has been fix. Related to the underlying fast ordering algorithm, the author introduced a bug in order to optimize performance, the author has fixed, but there is no go binary release, and so on, temporarily with the new version of sort to avoid.

Here are the test procedures, interested can see.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.