improve parsing of desktop entries.

- speed up parsing by not creating nearly as many strings.
- fix basic whitespace handling. fixes #4

goos: linux
goarch: amd64
pkg: github.com/nwg-piotr/nwg-drawer
cpu: AMD Ryzen 7 1800X Eight-Core Processor
BenchmarkDesktopEntryParserOld-16    	   10000	    146094 ns/op
BenchmarkDesktopEntryParser-16       	   26097	     43303 ns/op
PASS
ok  	github.com/nwg-piotr/nwg-drawer	3.090s
This commit is contained in:
James Lawrence
2021-08-31 06:06:56 -04:00
parent c5e39f179f
commit 57826c064d
4 changed files with 247 additions and 93 deletions

View File

@@ -59,6 +59,7 @@ type desktopEntry struct {
CommentLoc string
Icon string
Exec string
Category string
Terminal bool
NoDisplay bool
}