Class: Hone::Finding

Inherits:
Data
  • Object
show all
Defined in:
lib/hone/finding.rb

Overview

Represents a single optimization finding from static analysis.

Examples:

Creating a finding

finding = Finding.new(
  file: "app/models/user.rb",
  line: 42,
  column: 8,
  pattern_id: :positive_predicate,
  optimization_type: :cpu,
  source: :hone,
  message: "Use > 0 instead of .positive?",
  speedup: "Minor",
  code: "count.positive?"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs) ⇒ Finding

Returns a new instance of Finding.



60
61
62
# File 'lib/hone/finding.rb', line 60

def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
  super
end

Instance Attribute Details

#alloc_percentObject (readonly)

Returns the value of attribute alloc_percent

Returns:

  • (Object)

    the current value of alloc_percent



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#cpu_percentObject (readonly)

Returns the value of attribute cpu_percent

Returns:

  • (Object)

    the current value of cpu_percent



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#method_nameObject (readonly)

Returns the value of attribute method_name

Returns:

  • (Object)

    the current value of method_name



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#optimization_typeObject (readonly)

Returns the value of attribute optimization_type

Returns:

  • (Object)

    the current value of optimization_type



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#pattern_idObject (readonly)

Returns the value of attribute pattern_id

Returns:

  • (Object)

    the current value of pattern_id



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#priorityObject (readonly)

Returns the value of attribute priority

Returns:

  • (Object)

    the current value of priority



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end

#speedupObject (readonly)

Returns the value of attribute speedup

Returns:

  • (Object)

    the current value of speedup



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hone/finding.rb', line 45

Finding = Data.define(
  :file,
  :line,
  :column,
  :pattern_id,
  :optimization_type,  # :cpu, :allocation, :jit
  :source,             # :hone, :fasterer, :rubocop
  :message,
  :speedup,            # Optional: "1.5x faster"
  :code,               # Source code snippet
  :method_name,        # Populated by correlator
  :cpu_percent,        # Populated by correlator
  :alloc_percent,      # Populated by correlator (Phase 2)
  :priority            # :hot, :warm, :cold
) do
  def initialize(method_name: nil, cpu_percent: nil, alloc_percent: nil, priority: nil, **kwargs)
    super
  end
end