UniqChar
Table of Contents
- Features
- Requirements
- Setup
- Usage
- Tests
- Versioning
- Code of Conduct
- Contributions
- License
- History
- Credits
Features
Requirements
Setup
For an insecure install, type the following (not recommended):
gem install uniq_char
Add the following to your Gemfile:
gem "uniq_char"
Usage
require 'uniq_char'
'aabbce'.first_uniq_char
# => 'c'
'aabbce'.first_uniq_char2
# => 'c'
'aabbce'.uniq_chars
# => ['c', 'e']
'aabbce'.uniq_chars.first
# => 'c'
Tests
To test, run:
bundle exec rake
Benchmark
$ ruby spec/benchmark.rb
"Benchmark with 50 chars"
user system total real
first_uniq_char 0.000000 0.000000 0.000000 ( 0.000014)
first_uniq_char2 0.000000 0.000000 0.000000 ( 0.000028)
uniq_chars.first 0.000000 0.000000 0.000000 ( 0.000052)
"Benchmark with 500 chars"
user system total real
first_uniq_char 0.000000 0.000000 0.000000 ( 0.000180)
first_uniq_char2 0.000000 0.000000 0.000000 ( 0.000234)
uniq_chars.first 0.000000 0.000000 0.000000 ( 0.000232)
"Benchmark with 5000 chars"
user system total real
first_uniq_char 0.000000 0.000000 0.000000 ( 0.003596)
first_uniq_char2 0.000000 0.000000 0.000000 ( 0.001695)
uniq_chars.first 0.000000 0.000000 0.000000 ( 0.001970)
Conclusion:
Second & third implementation is better when having more characters
Versioning
0.2.0
Code of Conduct
Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.
Contributions
Read CONTRIBUTING for details.
License
Copyright (c) 2017 . Read the LICENSE for details.
History
Read the CHANGELOG for details. Built with Gemsmith.
Credits
Developed by zhitongLIU at .