class Nasl::CommandBenchmark

Public Class Methods

analyze(cfg, path, args) click to toggle source
# File lib/nasl/commands/benchmark.rb, line 35
def self.analyze(cfg, path, args)
  Benchmark.bmbm do |b|
    # Read in the file outside of the benchmark, to avoid contaminating it
    # with filesystem operations.
    contents = File.open(path, "rb").read

    b.report("Tokenize") do
      cfg[:iterations].times { Tokenizer.new(contents, path).get_tokens }
    end

    b.report("Parse") do
      cfg[:iterations].times { Parser.new.parse(contents) }
    end
  end
end
binding() click to toggle source
# File lib/nasl/commands/benchmark.rb, line 31
def self.binding
  'benchmark'
end