2

I'm investigating a lag, occurring after the first touch-input of my android-application. I used TraceView and tracked down the ~2 second lag to the initialization of Guava's Splitter.

enter image description here

  • Why does this take so long?
  • Am I reading TraceView's output correctly?
  • What can I do about this?

This is the line invoking Splitter:

String desc = /* loaded from assets */
List<String> descList = Lists.newArrayList(Splitter.on("\n").split(desc));
Fabian Zeindl
  • 5,860
  • 8
  • 54
  • 78

1 Answers1

7

I think this might be related to Guava Charmatcher static initialization slow and http://code.google.com/p/guava-libraries/issues/detail?id=1192 , since you need to construct a CharMatcher when constructing a Splitter. As you can see in TraceView, a lot of time is spent in CharMatcher.<clinit> (clinit = class initialization).

What version of Guava are you using?

Community
  • 1
  • 1
Etienne Neveu
  • 12,604
  • 9
  • 36
  • 59