Improved performance
This commit is contained in:
parent
09245c5e92
commit
68111da0a2
@ -43,9 +43,9 @@ coverage: 100.0% of statements
|
|||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
```
|
```
|
||||||
BenchmarkSmall-12 7223979 164.2 ns/op 64 B/op 2 allocs/op
|
BenchmarkSmall-12 8899971 131.5 ns/op 32 B/op 1 allocs/op
|
||||||
BenchmarkMedium-12 832531 1310 ns/op 992 B/op 2 allocs/op
|
BenchmarkMedium-12 980007 1217 ns/op 512 B/op 1 allocs/op
|
||||||
BenchmarkLarge-12 295946 3732 ns/op 3712 B/op 3 allocs/op
|
BenchmarkLarge-12 315229 3554 ns/op 2560 B/op 2 allocs/op
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -3,6 +3,7 @@ package markdown
|
|||||||
import (
|
import (
|
||||||
"html"
|
"html"
|
||||||
"strings"
|
"strings"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -40,7 +41,7 @@ func Render(markdown string) string {
|
|||||||
r.WriteString("</blockquote>")
|
r.WriteString("</blockquote>")
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(r.out)
|
return unsafe.String(unsafe.SliceData(r.out), len(r.out))
|
||||||
}
|
}
|
||||||
|
|
||||||
if i != len(markdown) && markdown[i] != '\n' {
|
if i != len(markdown) && markdown[i] != '\n' {
|
||||||
|
Loading…
Reference in New Issue
Block a user