Skip to content

Commit

Permalink
Merge pull request #3 from chehsunliu/chehsunliu/go-modules
Browse files Browse the repository at this point in the history
Use go modules
  • Loading branch information
chehsunliu authored Sep 8, 2019
2 parents 88ec7c2 + b7c99f0 commit 993dcb9
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 87 deletions.
184 changes: 181 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,184 @@
# Custom
.coverprofile
.coverprofile.html

# Created by https://www.gitignore.io/api/macos,windows,linux,vim,jetbrains
# Edit at https://www.gitignore.io/?templates=macos,windows,linux,vim,jetbrains

### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea

# User-specific stuff
#.idea/**/workspace.xml
#.idea/**/tasks.xml
#.idea/**/usage.statistics.xml
#.idea/**/dictionaries
#.idea/**/shelf

# Generated files
#.idea/**/contentModel.xml

# Sensitive or high-churn files
#.idea/**/dataSources/
#.idea/**/dataSources.ids
#.idea/**/dataSources.local.xml
#.idea/**/sqlDataSources.xml
#.idea/**/dynamic.xml
#.idea/**/uiDesigner.xml
#.idea/**/dbnavigator.xml

# Gradle
#.idea/**/gradle.xml
#.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
#.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
#.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
#.idea/httpRequests

# Android studio 3.1+ serialized cache file
#.idea/caches/build_file_checksums.ser

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
#.idea/sonarlint

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/macos,windows,linux,vim,jetbrains

# Created by https://www.gitignore.io/api/go
# Edit at https://www.gitignore.io/?templates=go

### Go ###
# Binaries for programs and plugins
Expand All @@ -12,15 +188,17 @@
*.so
*.dylib

# Test binary, build with `go test -c`
# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

### Go Patch ###
/vendor/
/Godeps/


# End of https://www.gitignore.io/api/go
39 changes: 0 additions & 39 deletions Gopkg.lock

This file was deleted.

30 changes: 0 additions & 30 deletions Gopkg.toml

This file was deleted.

7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
TEST_FLAGS = -short
EXTRA_FLAGS =

.PHONY: test
test:
go test -coverprofile .coverprofile -timeout 10m $(TEST_FLAGS) $(EXTRA_FLAGS) ./...
go test -coverprofile .coverprofile -timeout 10m ./...
go tool cover -html .coverprofile -o .coverprofile.html

.PHONY: benchmark
benchmark:
go test -bench=.
go test -bench=. -benchtime 5s
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ Three of a Kind

## Performance

Compared with [notnil/joker](https://github.com/notnil/joker), Poker is 180x faster on 5-card evaluation, and drops to 50x faster on 7-card evaluation.
Compared with [notnil/joker](https://github.com/notnil/joker), Poker is 160x faster on 5-card evaluation, and drops to 40x faster on 7-card evaluation.

```sh
$ go test -bench=. -benchtime 5s
go test -bench=. -benchtime 5s
goos: darwin
goarch: amd64
pkg: github.com/chehsunliu/poker
BenchmarkFivePoker-4 20000000 280 ns/op
BenchmarkFiveJoker-4 100000 50769 ns/op
BenchmarkSixPoker-4 3000000 2428 ns/op
BenchmarkSixJoker-4 30000 272321 ns/op
BenchmarkSevenPoker-4 300000 20317 ns/op
BenchmarkSevenJoker-4 5000 1062044 ns/op
BenchmarkFivePoker-4 23396181 253 ns/op
BenchmarkFiveJoker-4 141036 41662 ns/op
BenchmarkSixPoker-4 3037298 1949 ns/op
BenchmarkSixJoker-4 28158 211533 ns/op
BenchmarkSevenPoker-4 356448 16357 ns/op
BenchmarkSevenJoker-4 7143 759394 ns/op
PASS
ok github.com/chehsunliu/poker 43.996s
```
ok github.com/chehsunliu/poker 40.111s
```
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/chehsunliu/poker

go 1.13

require (
github.com/loganjspears/joker v0.0.0-20180219043703-3f2f69a75914
github.com/notnil/joker v0.0.0-20180219043703-3f2f69a75914 // indirect
github.com/stretchr/testify v1.4.0
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/loganjspears/joker v0.0.0-20180219043703-3f2f69a75914 h1:yAIlIiOkdoJvqd5xtWzM9tNDpLZrFfJdpnNSKha78G8=
github.com/loganjspears/joker v0.0.0-20180219043703-3f2f69a75914/go.mod h1:76SAnflG7ZFhgtnaVCpP6A5Z1S/VMFzRBN7KGm5j4oc=
github.com/notnil/joker v0.0.0-20180219043703-3f2f69a75914 h1:xXPuFr3PVM4p6Vw3j0CP29oWYRVKO3cPZjR6D7BxggQ=
github.com/notnil/joker v0.0.0-20180219043703-3f2f69a75914/go.mod h1:L0Sdr2nYdktjerdXpIn9wOCn+GebPs/nCL2qH6RTGa0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 comments on commit 993dcb9

Please sign in to comment.