Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8516

Re: slow as molasses

Newsgroups comp.lang.java.programmer
From Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Subject Re: slow as molasses
References <e160619b-d172-4986-8e05-880d27473c5f@k15g2000yqd.googlegroups.com>
Message-ID <slrnj8lrea.6gl.avl@gamma.logic.tuwien.ac.at> (permalink)
Date 2011-10-04 11:28 +0000

Show all headers | View raw


bob <bob@coolgroups.com> wrote:
> So, I wrote some code, but it is slow as molasses.  Any easy ways to
> speed this up?
> 	float[] getVertices(String filename) {
> 		try {
> 			AssetManager am = this.getResources().getAssets();
> 			InputStream is = am.open(filename);

Just speculating:
  Involving some of the Buffered* stream-wrappers here might help big time.

> 			Scanner s = new Scanner(is);
> 			long numfloats = s.nextLong();
> 			float[] f = new float[(int) numfloats];
> 			for (int ctr = 0; ctr < f.length; ctr++) {
> 				f[ctr] = s.nextFloat();
> 			}
> 			return f;
>
> 		} catch (IOException e) {
> 			e.printStackTrace();
> 			return null;
> 		}
>
> 	}

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

slow as molasses bob <bob@coolgroups.com> - 2011-10-04 02:16 -0700
  Re: slow as molasses Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-04 11:28 +0000
  Re: slow as molasses Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-04 07:47 -0700
  Re: slow as molasses Patricia Shanahan <pats@acm.org> - 2011-10-04 08:42 -0700
  Re: slow as molasses "John B. Matthews" <nospam@nospam.invalid> - 2011-10-04 13:30 -0400
    Re: slow as molasses bob <bob@coolgroups.com> - 2011-10-04 14:19 -0700

csiph-web