I have a string of about 8000000 UTF-8 characters. Scanning it via fmt.Scanf()
takes about 10 seconds, how can I do it faster? I have a Go wrapper for C scanf()
function that was written by my teacher as a workaround for some bugs in Go's fmt.Scanf(), it works in 1-2 seconds, but I don't like using side packages for such simple tasks. Could you suggest some faster way of reading strings in pure Go?
相关问题
- Faster loop: foreach vs some (performance of jsper
- Why wrapping a function into a lambda potentially
- Golang mongodb aggregation
- Ado.net performance:What does SNIReadSync do?
- Device support warning : Google play 2019
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Can I run a single test in a suite?
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- Show a different value from an input that what wil
- DOM penalty of using html attributes
- Which is faster, pointer access or reference acces
- Django is sooo slow? errno 32 broken pipe? dcramer
Found the solution.
bufio
works much faster (as it's buffered, andfmt
's functions are not, and it doesn't parse anything):...even faster that that C
scanf()
wrapper.