Is java.util.Scanner that slow?

后端 未结 7 1673
悲&欢浪女
悲&欢浪女 2021-02-07 08:17

In a Android application I want to use Scanner class to read a list of floats from a text file (it\'s a list of vertex coordinates for OpenGL). Exact code is:

Sc         


        
7条回答
  •  一整个雨季
    2021-02-07 08:59

    Yes I'm not seeing anything like this. I can read about 10M floats this way in 4 secs on the desktop, but it just can't be that different.

    I'm trying to think of other explanations -- is it perhaps blocking in reading the input stream from getAssets()? I might try reading that resource fully, timing that, then seeing how much additional time is taken to scan.

提交回复
热议问题