Skip to content

sort and nub functions should be marked as {-# INLINE #-} #50

Closed
@toyboot4e

Description

@toyboot4e

Hi, vector-algorithms have been crucial for competitive programming in Haskell. Huge thanks!

In version 0.9.0.3, some functions are very slow. Examples:

  • Data.Vector.Algorithms:
  • Data.Vector.Algorithms.Intro:
    • sort (marked as INLINABLE, not INLINE)

In va-bench repository, I tried adding {-# INLINE #-} pragmas and ran benchmarks. Here's a rough result:

1. Speed of intro sort

On VU.modify VAI.sort, {-# INLINE sort #-} makes it significantly faster:

Image

2. Other sort functions

Other sort functions should be marked as {-# INLINE #-}, too:

Image

3. nub

nub and nubBy should be marked as {-# INLINE #-}. I guess nubByMut should be at least marked as {-# INLINEABLE #-}:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions