Skip to content

Geometry Index GCC arch x86-64-v3 #1452

@sandman7920

Description

@sandman7920

When GCC compiles idx.qbegin(bgi::nearest(searchPoint, 5)) with -march=x86-64-v3, generated code is ~= 50% slower than x86-64-v2

Sniped:

for (size_t i = 0, end = records.size(); i < end; ++i) {
    const auto &r = records[i];
    const auto searchPoint = Point(r.lon, r.lat);
    for (auto it = idx.qbegin(bgi::nearest(searchPoint, 5)); it != idx.qend(); ++it) {
        if (it->second == i) {
            continue;
        }

        const auto d = bg::distance(it->first, searchPoint, haversine);
        if (d >= 100) {
            break;
        }

        if (d > 0.000001) {
            proximity.emplace_back(i, it->second);
            break;
        }
    }
}

I have tested with several boost versions, 1.69.0 is not affected, and also clang is not affected.
I suspect this is a GCC bug.

Some test results:

./gcc_boost_1.69_v2
load data took :     29.079 ms
index fill took:    450.315 ms
query all took :   4308.570 ms

in proximity: 11323

./gcc_boost_1.69_v3
load data took :     28.881 ms
index fill took:    467.378 ms
query all took :   4291.138 ms

in proximity: 11323

./gcc_boost_1.75_v2
load data took :     28.809 ms
index fill took:    452.619 ms
query all took :   3626.386 ms

in proximity: 11328

./gcc_boost_1.75_v3
load data took :     28.892 ms
index fill took:    490.710 ms
query all took :   6523.559 ms

./gcc_boost_1.90_v2
load data took :     29.007 ms
index fill took:    448.897 ms
query all took :   3645.700 ms

in proximity: 11328

./gcc_boost_1.90_v3
load data took :     29.016 ms
index fill took:    498.888 ms
query all took :   6531.580 ms

in proximity: 11328

main.cpp

data.csv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions