Last active
August 29, 2015 14:23
-
-
Save mantyr/6603c56d0e46df77d291 to your computer and use it in GitHub Desktop.
How to understand the delay on time?
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
$ go get github.com/fiam/gounidecode/unidecode | |
$ go get github.com/rainycape/unidecode | |
$ time go test github.com/fiam/gounidecode/unidecode | |
ok github.com/fiam/gounidecode/unidecode 0.039s | |
real 0m9.629s | |
user 0m1.621s | |
sys 0m1.647s | |
$ time go test github.com/rainycape/unidecode | |
ok github.com/rainycape/unidecode 0.197s | |
real 0m1.000s | |
user 0m0.328s | |
sys 0m0.154s | |
$ time go install ./test.go | |
real 0m0.534s | |
user 0m0.223s | |
sys 0m0.043s | |
$ time ./test | |
ABCDEF | |
Knosos | |
Bei Jing | |
real 0m0.034s | |
user 0m0.017s | |
sys 0m0.000s |
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
package main | |
import ( | |
uni "github.com/fiam/gounidecode/unidecode" | |
"fmt" | |
) | |
func testTransliteration(original string, decoded string) { | |
if r := uni.Unidecode(original); r != decoded { | |
fmt.Println("Error", decoded) | |
} | |
fmt.Println(decoded) | |
} | |
func TestASCII() { | |
s := "ABCDEF" | |
testTransliteration(s, s) | |
} | |
func TestKnosos() { | |
o := "Κνωσός" | |
d := "Knosos" | |
testTransliteration(o, d) | |
} | |
func TestBeiJing() { | |
o := "\u5317\u4EB0" | |
d := "Bei Jing " | |
testTransliteration(o, d) | |
} | |
func main() { | |
TestASCII() | |
TestKnosos() | |
TestBeiJing() | |
} |
Author
mantyr
commented
Jun 17, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment