Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Disk IO -> RAM optimisation?  (Read 1153 times)
0 Members and 1 Guest are viewing this topic.
Offline K.I.L.E.R

Senior Member




Java games rock!


« Posted 2004-01-27 02:16:12 »

Once I have loaded a file in my inputstream, should I copy the contents of th stream into a character buffer or a string?

I believe it's more efficient (processing wise) to use a string over a character buffer.

I realise the size of the string is the amount of characters is in it + 1. A character[] doesn't have that disadvantage but I hardly think that 1 byte is going to make a large difference. I'm trying to keep my file processing to an all time low.

Am I right and I should go with a string over a char[] buffer?

Thank You


Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline tom
« Reply #1 - Posted 2004-01-27 04:12:02 »

A String is a char[] so I don't see there being any differance.

What are you optimizing, and why?

Offline K.I.L.E.R

Senior Member




Java games rock!


« Reply #2 - Posted 2004-01-27 07:06:05 »

Thanks. I'm trying to make the IO disk(HD) operations fast. So I don't have to wait long to load files up into a string.

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2004-01-27 07:33:06 »

Don't use inputstreams then, use NIO and map the file directly or read into a CharBuffer.

It depends what you want to do with it once you've read it.

CAs Smiley

Offline K.I.L.E.R

Senior Member




Java games rock!


« Reply #4 - Posted 2004-01-27 11:40:53 »

Just display it on screen. Smiley

Thanks

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!