mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 00:53:42 +08:00
27 lines
710 B
Ruby
27 lines
710 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "ruby-prof"
|
|
|
|
def profile(&blk)
|
|
result = RubyProf.profile(&blk)
|
|
printer = RubyProf::GraphHtmlPrinter.new(result)
|
|
printer.print(STDOUT)
|
|
end
|
|
profile { "" } # loading profiler dependency
|
|
|
|
require File.expand_path("../../../../config/environment", __FILE__)
|
|
|
|
# warming up
|
|
SiteSetting.title
|
|
SiteSetting.enable_discourse_connect
|
|
SiteSetting.default_locale = SiteSetting.default_locale == "en" ? "zh_CN" : "en"
|
|
SiteSetting.title = SecureRandom.hex
|
|
|
|
profile { SiteSetting.title }
|
|
|
|
profile { SiteSetting.enable_discourse_connect }
|
|
|
|
profile { SiteSetting.default_locale = SiteSetting.default_locale == "en" ? "zh_CN" : "en" }
|
|
|
|
profile { SiteSetting.title = SecureRandom.hex }
|