项目作者: tgrk

项目描述 :
Generate Human Readable IDs
高级语言: Elixir
项目地址: git://github.com/tgrk/humanids.git
创建时间: 2019-12-18T23:35:36Z
项目社区:https://github.com/tgrk/humanids

开源协议:Apache License 2.0

下载


HumanIDs

CircleCI
Hex pm
Coverage Status

Simple Elixir library that generates human-readable ids from a list of nouns and adjectives. It makes ids easy
for communication with other humans.

Examples:

  • dinasaurs-gorillas-20
  • swam-burst-48
  • abbled-enthusiastically-98
  • mongooses-ran-41
  • glided-meerkat-98

Even that these ids are reasonably random, it is recommended not to use them as primary ids. Depending on your use-case.

Installation

If available in Hex, the package can be installed
by adding humanids to your list of dependencies in mix.exs:

  1. def deps do
  2. [
  3. {:humanids, "~> 0.1.0"}
  4. ]
  5. end

Benchmark

  1. $ mix run benchmark/default.exs
  2. Operating System: Linux
  3. CPU Information: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  4. Number of Available Cores: 4
  5. Available memory: 15.43 GB
  6. Elixir 1.9.0
  7. Erlang 22.0
  8. Benchmark suite executing with the following configuration:
  9. warmup: 2 s
  10. time: 5 s
  11. memory time: 0 ns
  12. parallel: 1
  13. inputs: none specified
  14. Estimated total run time: 21 s
  15. Benchmarking Generate 10 ids...
  16. Benchmarking Generate 100 ids...
  17. Benchmarking Genrate 1000 ids...
  18. Name ips average deviation median 99th %
  19. Generate 10 ids 1867.05 0.54 ms ±25.69% 0.51 ms 1.14 ms
  20. Generate 100 ids 188.21 5.31 ms ±16.28% 5.11 ms 8.17 ms
  21. Genrate 1000 ids 18.81 53.17 ms ±3.92% 52.79 ms 59.77 ms
  22. Comparison:
  23. Generate 10 ids 1867.05
  24. Generate 100 ids 188.21 - 9.92x slower +4.78 ms
  25. Genrate 1000 ids 18.81 - 99.27x slower +52.63 ms