Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can this code run faster?

Author
Message
Vespar
23
Years of Service
User Offline
Joined: 17th Jul 2003
Location: USA
Posted: 17th Jul 2003 17:35 Edited at: 17th Jul 2003 17:44


This code can take a very long time to run. I'm using
files as large as 5 meg to 10 meg. I would like this to
run in as little as 1 second. As it is now I've seen it take
as long as 30 seconds.

If it was converted to c++ how fast would it run? I dont
know too much about c++ and how to get DB to read c++ files.
Any help would be appreciated.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Jul 2003 17:43
You could load it as a memblock, I imagine memblock loading would be a great deal faster than loading byte by byte.

Also, try and avoid complex checks, instead of looking for 11111111, look for byte value 255.


Van-B

My cats breath smells of cat food.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Jul 2003 18:22 Edited at: 17th Jul 2003 18:24


would probably run a but faster in C++, but its more the way your checking than anything else

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Jul 2003 18:24
I've never really used files in db, but Van is right in that you need the whole file in memory before you start reading from it, else it'll be dead slow. There must be a way in db to put all that data in to RAM before you read from it. If there is a make memblock from file command, then that has to be the way.

Machine: P4 2200, 1GB RAM, GeForce4 64MB, Audigy Platinum
http://www.breakbeat-terrorism.co.uk
(It's not all about the coding)
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jul 2003 20:05
There is

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Jul 2003 20:30
for process loading it doesn't really matter speed wise using either the memblock or direct file access, they both load the file into buffer memory - the only reason you'd use the memblock is for continued used.

so ops outside of loading data, like a realtime textpad and such.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jul 2003 20:51
Hmmm, not quite true. I find it a lot faster to load the file in one go when I'm using byte operations, like when I did that height-map stuff (57MB file).

It's also easier - a 'for' loop with a known limit is easier to use (slightly) than detecting eof.

Login to post a reply

Server time is: 2026-07-21 12:48:56
Your offset time is: 2026-07-21 12:48:56