Thread: What mean filedescriptor error-codes?

  1. #31
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by lilcoder View Post
    fputs doesn't seem much faster than printf. It's best result was 4032ticks over 1000 tries..

    I'll redo the time-test this night with closed X-server and no network-connection to bypass any irregularities.
    Was that "viewing the output" or "disposing it in /dev/null"?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #32
    Registered User
    Join Date
    Sep 2007
    Posts
    26
    @salem: Yes, indeed it's limited by hd-speed and with me even more because my HD is full-encrypted. But I think I can get better than cat. Maybe my BUFSIZE isn't that good choosen as I thought because I thought taking exactly one mempage should be the best case. Maybe it's not. Or it was simply some other process while the syscall test which stole memmory which didn't run during the cat test.

    @matsp: this was now the printing way. If I do this speedtest code I posted with > /dev/null also the result will be dumped. Okay I could write it to a file before.. but all tests show, that syscall_writing to the screen is a bit faster than printf or fputs. It's simply the time to the libC which is not with using syscalls.

  3. #33
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by lilcoder View Post
    @salem: Yes, indeed it's limited by hd-speed and with me even more because my HD is full-encrypted. But I think I can get better than cat. Maybe my BUFSIZE isn't that good choosen as I thought because I thought taking exactly one mempage should be the best case. Maybe it's not. Or it was simply some other process while the syscall test which stole memmory which didn't run during the cat test.

    @matsp: this was now the printing way. If I do this speedtest code I posted with > /dev/null also the result will be dumped. Okay I could write it to a file before.. but all tests show, that syscall_writing to the screen is a bit faster than printf or fputs. It's simply the time to the libC which is not with using syscalls.
    Yes, but you are also spending most of the time scrolling the display, rather than performing system call - which is like measuring the speed of a car in Central London (or NYC) during rush-hour and saying "Cars do 12mph maximum". Use the same car somewhere a bit less full of traffic, and you are going to get a different result!

    There is indeed some overhead in using the C library - this is not a new discussion. But the C library isn't there to stop you from doing what you want and doing it reasonably efficiently - it is there to help you get the job done with relative ease.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #34
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by lilcoder View Post
    @salem: Yes, indeed it's limited by hd-speed and with me even more because my HD is full-encrypted. But I think I can get better than cat. Maybe my BUFSIZE isn't that good choosen as I thought because I thought taking exactly one mempage should be the best case. Maybe it's not. Or it was simply some other process while the syscall test which stole memmory which didn't run during the cat test.
    Unlikely that some other process steals 3-4 seconds out of two minutes, but certainly encrypted hard disk content will make a difference, and but it's the same for both.

    As for buffer size, try a size that is roughly half the L2 cache of your processor.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed