Skip to content

Cache parents for permutations in perm, cperm and @perm#4582

Merged
lgoettgens merged 1 commit intomasterfrom
mh/cache-symmetric-groups
Feb 12, 2025
Merged

Cache parents for permutations in perm, cperm and @perm#4582
lgoettgens merged 1 commit intomasterfrom
mh/cache-symmetric-groups

Conversation

@fingolfin
Copy link
Copy Markdown
Member

@fingolfin fingolfin commented Feb 12, 2025

... and generally in functions which create a permutation without taking a parent as argument.

Before:

julia> g = symmetric_group(4); v = [1,2]; w = [3,4];

julia> @b cperm($g,$v,$w)
888.889 ns (14 allocs: 352 bytes)

julia> @b cperm($v,$w)
12.500 μs (196 allocs: 16.242 KiB)

After:

julia> g = symmetric_group(4); v = [1,2]; w = [3,4];

julia> @b cperm($g,$v,$w)
822.600 ns (14 allocs: 352 bytes)

julia> @b cperm($v,$w)
909.700 ns (14 allocs: 352 bytes)

... and generally in functions which create a permutation without
taking a parent as argument.

Before:
    julia> g = symmetric_group(4); v = [1,2]; w = [3,4];

    julia> @b cperm($g,$v,$w)
    888.889 ns (14 allocs: 352 bytes)

    julia> @b cperm($v,$w)
    12.500 μs (196 allocs: 16.242 KiB)

After:

    julia> g = symmetric_group(4); v = [1,2]; w = [3,4];

    julia> @b cperm($g,$v,$w)
    822.600 ns (14 allocs: 352 bytes)

    julia> @b cperm($v,$w)
    909.700 ns (14 allocs: 352 bytes)
Copy link
Copy Markdown
Member

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very elegant

@lgoettgens lgoettgens enabled auto-merge (squash) February 12, 2025 22:02
@lgoettgens lgoettgens merged commit 7e7361d into master Feb 12, 2025
@lgoettgens lgoettgens deleted the mh/cache-symmetric-groups branch February 12, 2025 22:38
@fingolfin fingolfin changed the title Cache parents for permutations in perm, cperm, @perm, ... Cache parents for permutations in perm, cperm, @perm Feb 27, 2025
@fingolfin fingolfin added enhancement New feature or request optimization Simpler/more performant code or more/better tests release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Feb 27, 2025
@fingolfin fingolfin changed the title Cache parents for permutations in perm, cperm, @perm Cache parents for permutations in perm, cperm and @perm Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request optimization Simpler/more performant code or more/better tests release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: groups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants