```ruby
module Dry
  module Types
    module Result
      class Success < ::Struct.new(:input)
        def success?
          true
        end

        def failure?
          false
        end
      end

      class Failure < ::Struct.new(:input, :error)
        def success?
          false
        end

        def failure?
          true
        end
      end
    end
  end
end
```

Refactor Result to use a custom base class (stdlib Struct is SLOW)
user
```ruby
require 'dry/equalizer'

module Dry
  module Types
    class Result
      include Dry::Equalizer(:input)

      attr_reader :input

      def initialize(input)
        @input = input
      end

      class Success < Result
        def success?
          true
        end

        def failure?
          false
        end
      end

      class Failure < Result
        include Dry::Equalizer(:input, :error)

        attr_reader :error

        def initialize(input, error)
          super(input)
          @error = error
        end

        def success?
          false
        end

        def failure?
          true
        end
      end
    end
  end
end
```
assistant