Category: Performance

Reading text files is damn slow on Android!

In a Android application I wanted 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: Scanner in = new Scanner(new BufferedInputStream(getAssets().open(""))); final float[] vertexes = new float[nrVertexes]; for(int i=0;i vertexes[i] = in.nextFloat(); } It […]