Skip to content

Fast ruby idioms #1099

@michaelachrisco

Description

@michaelachrisco

The fasterer gem has some good examples showing what methods are currently faster within ruby. I ran it on grape and found a few areas of improvement.

$ fasterer
lib/grape/dsl/inside_route.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 225.

lib/grape/endpoint.rb
Hash#fetch with second argument is slower than Hash#fetch with block. Occurred at lines: 155.

lib/grape/middleware/formatter.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 20.

lib/grape/middleware/versioner/header.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 47, 122, 129.

spec/grape/integration/rack_spec.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 23.

spec/grape/middleware/formatter_spec.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 12, 143, 147, 151, 157, 167, 172, 177.

spec/grape/middleware/versioner/accept_version_header_spec.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 21, 27.

spec/grape/middleware/versioner/header_spec.rb
Parallel assignment is slower than sequential assignment. Occurred at lines: 18, 25, 32, 41, 47, 59, 65, 75, 81, 102, 108, 131, 137.

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