Sha256: 359a41c5877fbe8601307e9c442a07e43962a2e8399ed310cb60dac1d6787652

Contents?: true

Size: 790 Bytes

Versions: 527

Compression:

Stored size: 790 Bytes

Contents

# typed: true
# frozen_string_literal: true

module T::Profile
  SAMPLE_RATE = 101 # 1 out of that many typechecks will be measured
  class <<self
    attr_accessor :typecheck_duration
    attr_accessor :typecheck_samples
    attr_accessor :typecheck_sample_attempts
    def typecheck_duration_estimate
      total_typechecks = typecheck_samples * SAMPLE_RATE + (SAMPLE_RATE - typecheck_sample_attempts)
      typechecks_measured = typecheck_samples * SAMPLE_RATE
      typecheck_duration * SAMPLE_RATE * 1.0 * total_typechecks / typechecks_measured
    end

    def typecheck_count_estimate
      typecheck_samples * SAMPLE_RATE
    end

    def reset
      @typecheck_duration = 0
      @typecheck_samples = 0
      @typecheck_sample_attempts = SAMPLE_RATE
    end
  end
  self.reset
end

Version data entries

527 entries across 527 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.5823 lib/types/profile.rb
sorbet-runtime-0.5.5821 lib/types/profile.rb
sorbet-runtime-0.5.5820 lib/types/profile.rb
sorbet-runtime-0.5.5818 lib/types/profile.rb
sorbet-runtime-0.5.5815 lib/types/profile.rb
sorbet-runtime-0.5.5813 lib/types/profile.rb
sorbet-runtime-0.5.5809 lib/types/profile.rb
sorbet-runtime-0.5.5808 lib/types/profile.rb
sorbet-runtime-0.5.5803 lib/types/profile.rb
sorbet-runtime-0.5.5796 lib/types/profile.rb
sorbet-runtime-0.5.5795 lib/types/profile.rb
sorbet-runtime-0.5.5794 lib/types/profile.rb
sorbet-runtime-0.5.5790 lib/types/profile.rb
sorbet-runtime-0.5.5786 lib/types/profile.rb
sorbet-runtime-0.5.5784 lib/types/profile.rb
sorbet-runtime-0.5.5781 lib/types/profile.rb
sorbet-runtime-0.5.5779 lib/types/profile.rb
sorbet-runtime-0.5.5777 lib/types/profile.rb
sorbet-runtime-0.5.5772 lib/types/profile.rb
sorbet-runtime-0.5.5767 lib/types/profile.rb