TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Bilow
from: Paul Edwards
date: 1995-08-29 22:55:10
subject: dossubset

PE> In my "Tobruk" mailprocessor, I have done some performance 
PE> stats, and they show that 1/3 of the time is being spent in 
PE> "DOSCALL1.DLL", and 100% of that is in the function 
PE> "DosSubSet", which is a function that deals with memory 
PE> management.  In Tobruk itself, it allocates the memory upfront, 
PE> and never calls malloc again.  I had expected to see a fair 
PE> amount of time spent in "DosWrite", but that has 0 allocated to 
PE> it.  Any ideas what I am seeing?

MB> My guess is that you are seeing the C run-time library calling malloc().

Well it's pretty horendous if that's the case.  This program
when profiled registers 95% of the time spent in DosSubSet!!!
I've just gone and rewritten it to use DosWrite directly rather
than going through fwrite(), and guess what, it shows 99.7%
of the time spent in DosSubSet now!!!  I'll post that program
in my next message.  


#include 

static char buf[30000];

int main(void)
{
    int x;
    FILE *fq;
    
    fq = fopen("temp.txt", "wb");
    for (x = 0; x < 2000; x++)
    {
        fwrite(buf, sizeof buf, 1, fq);
    }
    fclose(fq);
    return (0);
}
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.