Skip to content

Improve comparing Singular and Julia/Nemo coefficients #907

@fingolfin

Description

@fingolfin

Consider this:

julia> a_nemo, b_nemo, c_nemo = Nemo.ZZ(5), Nemo.ZZ(7), Nemo.ZZ(3)^100;

julia> a_sing, b_sing, c_sing = Singular.ZZ(5), Singular.ZZ(7), Singular.ZZ(3)^100;

julia> @b $a_nemo == $b_nemo
4.013 ns

julia> @b $a_nemo == 5
3.705 ns

julia> @b $a_nemo == $b_sing
138.743 ns (5 allocs: 96 bytes)

julia> @b $a_sing == $b_sing
52.994 ns (3 allocs: 48 bytes)

julia> @b $a_sing == 5
311.557 ns (11 allocs: 176 bytes)

Especially the last one is really bad, comparing a Singular integer to a Julia machine int should not require so many allocations.


Of course the above is just with n_Z, but it also affects n_Q and finite field elements and probably others, to varying degrees.

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