-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Always encode ULIDs * Implement `ULID.gen` for String optimized generator * Removed lazy calculation for `ULID#to_s` * Prefer `ULID#encode` rather than `to_s` in implementation * Update documents with renaming to `ULID.encode` * Fix YARD * Add stackprof for the profiling * Add stackprof for the profiling * Make 2x faster with `String#tr`
- Loading branch information
Showing
17 changed files
with
187 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# coding: utf-8 | ||
# frozen_string_literal: true | ||
|
||
require('benchmark/ips') | ||
require_relative('../lib/ulid') | ||
|
||
Benchmark.ips do |x| | ||
x.report('ULID.generate.to_s') { ULID.generate.to_s } | ||
x.report('ULID.encode') { ULID.encode } | ||
x.compare! | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
# shareable_constant_value: literal | ||
|
||
class ULID | ||
VERSION = '0.5.0' | ||
VERSION = '0.6.0.pre' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# coding: us-ascii | ||
# frozen_string_literal: true | ||
|
||
require 'stackprof' | ||
require_relative '../lib/ulid' | ||
|
||
StackProf.run(mode: :wall, out: "./tmp/stackprof-wall-#{Time.now.to_i}.dump") do | ||
100000.times { ULID.encode } | ||
end | ||
|
||
StackProf.run(mode: :cpu, out: "./tmp/stackprof-cpu-#{Time.now.to_i}.dump") do | ||
100000.times { ULID.encode } | ||
end |
Oops, something went wrong.