mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Prepare new structure for migrations-tooling (#26631)
* Moves existing files around. All essential scripts are in `migrations/bin`, and non-essential scripts like benchmarks are in `migrations/scripts` * Dependabot configuration for migrations-tooling (disabled for now) * Updates test configuration for migrations-tooling * Shorter configuration for intermediate DB for now. We will add the rest table by table. * Adds a couple of benchmark scripts * RSpec setup especially for migrations-tooling and the first tests * Adds sorting/formatting to the `generate_schema` script
This commit is contained in:
25
migrations/scripts/benchmarks/time_formatting.rb
Executable file
25
migrations/scripts/benchmarks/time_formatting.rb
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/inline"
|
||||
|
||||
gemfile(true) do
|
||||
source "https://rubygems.org"
|
||||
gem "benchmark-ips"
|
||||
end
|
||||
|
||||
require "benchmark/ips"
|
||||
require "time"
|
||||
|
||||
THE_TIME = Time.now.utc
|
||||
DATE_TIME = DateTime.now.new_offset(0)
|
||||
|
||||
Benchmark.ips do |x|
|
||||
x.config(time: 10, warmup: 2)
|
||||
|
||||
x.report("Time#iso8601") { THE_TIME.iso8601 }
|
||||
x.report("Time#strftime") { THE_TIME.strftime("%FT%TZ") }
|
||||
x.report("DateTime#iso8601") { DATE_TIME.iso8601 }
|
||||
|
||||
x.compare!
|
||||
end
|
Reference in New Issue
Block a user