Re: Reading and Writing Files at the C level



Damon Courtney wrote:
Is there any significant performance hit from using the Tcl
functions (Tcl_Read, Tcl_Write) at the C level over using the lower
functions (fread, fwrite or read, write)? This is for both Windows and
UNIX.

"significant" is always context dependent.

Tcl_Read and Tcl_Write apply at least the encoding, translation, and
EOF character processing of Tcl channels to the data that passes through.
They do more work than the low-level fread() and fwrite(), so they can't
be equivalently fast.

Whether they're fast enough, is an app-specific question only
measurement can resolve.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.



Relevant Pages

  • Re: success! I think
    ... Fread and fwrite require a buffer size and number of ... printf("Can't open input file %s\n",inputfile); ... exit; ...
    (comp.lang.c)
  • Re: Type of argc
    ... I cannot agree that the designers of calloc, fread, and fwrite were ... unsigned type (and, indeed, over the weekend I pointed out why this was ...
    (comp.std.c)
  • Re: success! I think
    ... Fread and fwrite require a buffer size and number of elements. ... printf("Can't open input file %s\n",inputfile); ... exit; ...
    (comp.lang.c)
  • Re: read( ) versus fread( )
    ... fread() and fwrite() are functions from the C standard and are thus ... In contrast readand writeare operating system dependend ... You need to specify the ...
    (comp.unix.programmer)
  • Re: binary IO and portability
    ... If you were planning on using fread() and fwrite() operating ... >my program data to be portable and I just read this warning in the ... You convert back with shifting and bitwise ...
    (comp.lang.c)