What is causing huge performance differences in these c write() calls? [closed]
Does anybody see the difference between these two lines?
1) ret = write( fd_out, local_bugger, bytes_to_move);
2) nwritten = write (fd, buf + total_written, size - total_written);
Obviously, not the naming conventions.
Specifically, one is writing over the network 4x faster than the other.
Looking for logic , flags, etc
THANKS
what are the values/types of all those? Right now this question can't be answered... does option 2) end up writing 4x as much data? What are the flag options on the fopens for the two handle? etc...
Right now I'll guess that it's because mars is ascendent in jupiter and the moon is gibbous waxing, causing the higgs bosons to mess with the quarks in your ethernet cable.
There could be two things at play here:
- The size of the chunks you're writing. Small chunks incur more overhead. But that's unlikely to cause a big difference unless you're writing less than 16 bytes or so.
- The details of the file descriptor you're writing to. How much buffering does it have? Is it going through a filesystem (NFS or CIFS)? Is it even going out over the same network?
In short, as Marc B answered: not enough information.
精彩评论