Test out Ascendancy Input Streams!

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

         Name         | Average Time | Highest Time | Lowest Time
----------------------|--------------|--------------|-------------
Standard 1 Input      |1.84          |1.91          |1.81
Ascendancy 1 Input    |1.35          |1.41          |1.20
----------------------|--------------|--------------|-------------
Standard 255 Input    |0.011         |0.020         |0.010
Ascendancy 255 Input  |0.007         |0.015         |0.005
----------------------|--------------|--------------|-------------
Standard 1024 Input   |0.008         |0.010         |0.007
Ascendancy 1024 Input |0.003         |0.005         |0.003
----------------------|--------------|--------------|-------------
Standard 2048 Input   |0.008         |0.008         |0.008
Ascendancy 2048 Input |0.002         |0.003         |0.002
----------------------|--------------|--------------|-------------


Also, I encourage you to use the help command, and try out the commands therein (regrettably not a full list), seeing if you manage to break anything [smile] It all works fine over here, but as with the streams, I'd like to verify that it works well everywhere else as well, at least at this point. Note that calling the fError command and crashing out with a notifcation and a log entry is not considered 'breaking' it, as that functionality is specifically there [smile] Thanks a lot folks, and if you want to know how my implementation works, feel free to ask, the only reason I'm not posting it right now is that this post is long enough already [grin] This program has only been verified to work on Windows XP though in theory it should also work on some other windows platforms. If you have a version of Windows other then XP, please do try everything out, I'd appreciate it. As the FileInputStream calls Windows API methods directly (as well as some of my other functions) this demo, and indeed Ascendancy, is Windows only.

Share on other sites
These timings are from my work PC. I'll run it again when I get home tonight.
- Intel 2.0GHz P4
- 1GB RAM
- Crappy nearly full 40GB 7200RPM drive
- Windows 2K (SP?)

         Name         | Average Time | Highest Time | Lowest Time |----------------------|--------------|--------------|-------------|Standard 1 Input      |1.172         |1.179         |1.165        |Ascendancy 1 Input    |1.137         |1.152         |1.126        |----------------------|--------------|--------------|-------------|Standard 255 Input    |0.015         |0.029         |0.010        |Ascendancy 255 Input  |0.007         |0.009         |0.007        |----------------------|--------------|--------------|-------------|Standard 1024 Input   |0.007         |0.008         |0.007        |Ascendancy 1024 Input |0.004         |0.005         |0.004        |----------------------|--------------|--------------|-------------|Standard 2048 Input   |0.008         |0.016         |0.006        |Ascendancy 2048 Input |0.003         |0.003         |0.003        |----------------------|--------------|--------------|-------------|

[Edited by - pragma Fury on June 7, 2005 7:10:32 PM]

Share on other sites
Noted and appreciated [smile] I find it odd however, that your times at 1 byte per read operation are significantly lower then mine with the standard file input, while your timings with Ascendancy input are about the same.. Oh, also, I forgot to mention, please say what OS you were using. I assume you were running WinXP?

Thanks man, and again, any and all are welcome and indeed encouraged to test it out [smile]

Share on other sites
Not to dishearten you, or discourage learning, or to say its not possible to out do C++ standard I/O stream & locales in speed its probably quite easy to do considering the amount of stuff that goes on behind a stream for formatted I/O.

I'm just alittle skeptical & curious (as always [grin]) about the results and how the streams where used in code.

For example did you turn off synchronisation with C I/O? e.g.

std::ios_base::sync_with_stdio(false);

In some cases this can dramatically improve performance.

Another thing that needs be considered is how complex the architecture of C++ I/O streams library really is (thats not to say its perfect or good of-course), there is even a ~600 page book on the subject alone. I think most people don't relize this.

The streams are really nothing more than an interface & mediator to whole bunch of things; stream buffers & stream buffer iterators, locale & facet objects, stream callbacks (when used), proper error handling, exceptions (off by default), proper resource & memory management. All these combined allow you to do localized/internationalized formatted I/O.

For unformatted I/O its probably better just to use the stream buffers directly as they deal with the transportation layer (transport of characters to and from an external device) and possible buffering. For example if i remember correctly MinGW's imp of std::basic_filebuf also uses Win32 low-level I/O routines.

This would probably make the test more fair and may even make the results roughly equal.

Share on other sites
Sceptical and curious? Yep, in reality, that sums up pretty much every programmer I've seen [grin]

I don't have the codebase here right now, I'll have to try that out tomorrow morning, when I get back to my other PC.. Regarding the complexity of standard streams, yes, I know they do a huge amount of stuff in the background. And going from the info contained in your post, I am led to believe a lot of it is getting data from devices, syncing, formatting, etc. And this is precisely the sort of stuff I don't need to have going on, so I cut it out, when straight up against the windows API, created my own middle layer. Because this is a game engine, I don't need a load of extra junk in my streams. If I want keyboard input, I'll use Direct Input, or whatever other input handler I end up using (are there even any others? I haven't heard of any, to tell you the truth).

As for the usage, well, here's my setup, roughly.. First off, we have a basic InputStream class (as well as an OutputStream, haven't done any work on that or it's derived buddies yet). Now, we have a number of classes inheriting from that InputStream, such as FileInputStream, MemoryInputStream, and their compression and/or encryption reading counterparts. I'm not out to replicate the standard library's streams, with console input, output etc, I'm just making a quick and standardized (for Ascendancy) method for accessing file and memory streams, be they plain, compressed or encrypted. That way, you have a compressed flle? Just open up a Compressed File Input Stream, and read from it as you would a normal file. An encrypted stream of serialized bytes in memory? Opum an Encryption Memory Innput Stream, read from it same as with any other memory or file stream.

I'll try out turning of syncing tomorrow, and post the results, as well as updating the build if necessary.

Share on other sites
Quote:
 Original post by SirLuthorNoted and appreciated [smile] I find it odd however, that your times at 1 byte per read operation are significantly lower then mine with the standard file input, while your timings with Ascendancy input are about the same.. Oh, also, I forgot to mention, please say what OS you were using. I assume you were running WinXP?Thanks man, and again, any and all are welcome and indeed encouraged to test it out [smile]

Nope, I was running 2K (not sure what SP) And np. Here are the results from my home computer:
- Windows XP SP2
- Athlon 64 3500+
- 1GB PC4000
- 10K RPM 36GB WD Raptor

         Name         | Average Time | Highest Time | Lowest Time ----------------------|--------------|--------------|-------------Standard 1 Input      |0.756         |0.758         |0.756        Ascendancy 1 Input    |0.722         |0.723         |0.722        ----------------------|--------------|--------------|-------------Standard 255 Input    |0.008         |0.008         |0.008        Ascendancy 255 Input  |0.004         |0.004         |0.004        ----------------------|--------------|--------------|-------------Standard 1024 Input   |0.005         |0.006         |0.005        Ascendancy 1024 Input |0.001         |0.002         |0.001        ----------------------|--------------|--------------|-------------Standard 2048 Input   |0.005         |0.006         |0.005        Ascendancy 2048 Input |0.001         |0.001         |0.001        ----------------------|--------------|--------------|-------------

.. why doesn't the 255InputProfile test conform to the ^2 that the 1024 and 2048 tests do? That is, why isn't it 256InputTest?

Share on other sites
Oh, heheh, it's 255, because I made the character buffer a 256 array, remembered that the last character has to be the NULL terminator, and then couldn't be bothered to change all the references to it's size by 1... Also, this way, it's a size that the automatic cache size (65536) doesn't devide by, for whatever it's worth, so you'll get a cache reload in the middle of a read operation, as opposed to at the end of one. Shouldn't make any real difference though.

Did you perchance try out any of the other commands? If so, did every work fine, that is, without crashing or doing something unwarranted?

Ahh, enough for tonight, I'm turning in, it's 1:00 in the morning here...

Share on other sites
Hey,

As a sidenote, ctrl-z borks the system causing it to fall into an endless loop of
>_ * Command not recognized.

CJM

Share on other sites
Thanks mate, I'll look into that.

[EDIT] I tried out turning off syncing with C I/O, and here are my results:
         Name         | Average Time | Highest Time | Lowest Time ----------------------|--------------|--------------|-------------Standard 1 Input      |1.33          |1.65          |1.18         Ascendancy 1 Input    |0.999         |1.8           |0.991        ----------------------|--------------|--------------|-------------Standard 255 Input    |0.010         |0.010         |0.010        Ascendancy 255 Input  |0.005         |0.006         |0.005        ----------------------|--------------|--------------|-------------Standard 1024 Input   |0.007         |0.007         |0.007        Ascendancy 1024 Input |0.003         |0.003         |0.003        ----------------------|--------------|--------------|-------------Standard 2048 Input   |0.006         |0.006         |0.006        Ascendancy 2048 Input |0.002         |0.002         |0.002        ----------------------|--------------|--------------|-------------

You were definitely right snk_kid, it did have quite a positive effect on the timings of the standard filestreams, but stil not enough [smile] I'll look into trying out the basic_filebuf later on.

[Edited by - SirLuthor on June 8, 2005 7:04:43 AM]

1. 1
2. 2
JoeJ
17
3. 3
4. 4
frob
11
5. 5

• 13
• 16
• 13
• 20
• 13
• Forum Statistics

• Total Topics
632181
• Total Posts
3004625

×