Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: Utilizer
Java and Python versions of the code were written..

The real issue isn't memory vs. disk, its what the language you are using does to perform the string concatenation operation.

The fastest technique will be one that does string concatenation in memory while the disk write of the previous string section is completing, so that the disk latencies are used for string building. Oh, and of course the string concatenation code should be designed to run in cache and avoid any virtual memory paging or extra memory copy operations.

The key to performance is understanding how the system works, and writing code at a low enough level to be able to control how it interacts with the system. That's why C and C++ still get used.

The technique of "writing 1 byte at a time" to the disk is really just a way of utilizing the buffering present in the I/O system to queue up disk writes. All the interesting stuff is actually happening in memory, however its being done by clever system code written by people who understand how to get high performance.

A well written version of the string concatenation test should be able to write data to the disk as fast as the disk can write data.

10 posted on 03/26/2015 8:50:17 PM PDT by freeandfreezing
[ Post Reply | Private Reply | To 1 | View Replies ]


To: freeandfreezing

Assembly is still most efficient, especially if the action has to occur frequently in a system of modest capabilities.


13 posted on 03/26/2015 8:54:23 PM PDT by Paladin2
[ Post Reply | Private Reply | To 10 | View Replies ]

To: freeandfreezing

Yep. The VM paging code in Windows is highly optimized, going all the way back to David Cutler’s Windows NT in 1996 (and DEC VAX/VMS before that).

Generally the fastest way to write a file in Windows is to just call ::CreateMemoryMapping() and scribble away. You avoid the double buffering of ::WriteFile(), and the VM subsystem is smart enough to do readaheads and stride I/O too.


17 posted on 03/26/2015 9:09:42 PM PDT by Gideon7
[ Post Reply | Private Reply | To 10 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson