开发者

What is causing huge performance differences in these c write() calls? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that开发者_StackOverflow社区 it can be reopened, visit the help center. Closed 11 years ago.

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:

  1. 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.
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜