From: "Adrian Francis" Subject: Re: Speed Test - TC vs. DJGPP Newsgroups: comp.os.msdos.djgpp References: <01bd492f$47fb8b40$929175c2 AT ctx> <34FFF92A DOT 3ECF AT cam DOT org> Message-ID: <01bd4945$71bb18e0$8c9175c2@ctx> NNTP-Posting-Host: usr130-wol.cableinet.co.uk Date: 6 Mar 98 21:32:26 GMT Organization: "Cable Internet (post doesn't reflect views of Cable Internet)" Lines: 264 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Vic wrote in article <34FFF92A DOT 3ECF AT cam DOT org>... > Adrian Francis wrote: > > DJGPP - tics:13345 sec:146 > > TC - tics:5 sec:0 > > > > Can someone explain why this is happening? I would expect DJGPP to be > > twice as fast considering it is a 32bit compiler. Something must be >wrong! > indeed, something is wrong. 146 seconds?? > Without optimising anything, I get 10 tics. I get 5 tics with > optimisations on your program (O3) > -- > --> http://www.cam.org/~tudor <-- > I get 5 tics with -O3 but I still have 13345 without optimizations! If you got 10 tics without, that means I must have a serious problem somewhere. Maybe someone can work it out from the assembler dump below. I would appreciate it. I can make sense out of most of it, but I don't know what's going on in the _sub function. What's _mcount doing? Thanks! -ADRIAN- .file "speed.c" gcc2_compiled.: ___gnu_compiled_c: .space 4 .text .def _clock_t; .scl 13; .type 04; .endef .def _size_t; .scl 13; .type 017; .endef .def _time_t; .scl 13; .type 016; .endef .def _tm; .scl 10; .type 010; .size 44; .endef .def _tm_sec; .val 0; .scl 8; .type 04; .endef .def _tm_min; .val 4; .scl 8; .type 04; .endef .def _tm_hour; .val 8; .scl 8; .type 04; .endef .def _tm_mday; .val 12; .scl 8; .type 04; .endef .def _tm_mon; .val 16; .scl 8; .type 04; .endef .def _tm_year; .val 20; .scl 8; .type 04; .endef .def _tm_wday; .val 24; .scl 8; .type 04; .endef .def _tm_yday; .val 28; .scl 8; .type 04; .endef .def _tm_isdst; .val 32; .scl 8; .type 04; .endef .def ___tm_zone; .val 36; .scl 8; .type 022; .endef .def ___tm_gmtoff; .val 40; .scl 8; .type 04; .endef .def .eos; .val 44; .scl 102; .tag _tm; .size 44; .endef .def _timeval; .scl 10; .type 010; .size 8; .endef .def _tv_sec; .val 0; .scl 8; .type 016; .endef .def _tv_usec; .val 4; .scl 8; .type 05; .endef .def .eos; .val 8; .scl 102; .tag _timeval; .size 8; .endef .def _timezone; .scl 10; .type 010; .size 8; .endef .def _tz_minuteswest; .val 0; .scl 8; .type 04; .endef .def _tz_dsttime; .val 4; .scl 8; .type 04; .endef .def .eos; .val 8; .scl 102; .tag _timezone; .size 8; .endef .def _dev_t; .scl 13; .type 04; .endef .def _ino_t; .scl 13; .type 04; .endef .def _mode_t; .scl 13; .type 04; .endef .def _nlink_t; .scl 13; .type 04; .endef .def _gid_t; .scl 13; .type 04; .endef .def _off_t; .scl 13; .type 04; .endef .def _pid_t; .scl 13; .type 04; .endef .def _ssize_t; .scl 13; .type 04; .endef .def _uid_t; .scl 13; .type 04; .endef .def _fd_set; .scl 10; .type 010; .size 32; .endef .def _fd_bits; .val 0; .scl 8; .dim 32; .size 32; .type 074; .endef .def .eos; .val 32; .scl 102; .tag _fd_set; .size 32; .endef .def _fd_set; .scl 13; .tag _fd_set; .size 32; .type 010; .endef .def _uclock_t; .scl 13; .type 05; .endef .align 4 .def _sub; .val _sub; .scl 2; .type 041; .endef .globl _sub _sub: .def .bf; .val .; .scl 101; .line 4; .endef pushl %ebp movl %esp,%ebp cmpl $0,LPBX0 jne LPBZ0 pushl $LPBX0 call ___bb_init_func addl $4,%esp LPBZ0: .data .align 2 LP0: .long 0 .text movl $LP0,%edx call _mcount .ln 2 L1: LPB0: incl LPBX2 .def .ef; .val .; .scl 101; .line 2; .endef movl %ebp,%esp popl %ebp ret .def _sub; .val .; .scl -1; .endef LC0: .ascii "tics:%d\0" LC1: .ascii "sec:%d\0" .align 4 .def _main; .val _main; .scl 2; .type 041; .endef .globl _main _main: .def .bf; .val .; .scl 101; .line 8; .endef pushl %ebp movl %esp,%ebp subl $16,%esp pushl %ebx cmpl $0,LPBX0 jne LPBZ1 pushl $LPBX0 call ___bb_init_func addl $4,%esp LPBZ1: .data .align 2 LP1: .long 0 .text movl $LP1,%edx call _mcount LPB1: incl LPBX2+4 call ___main .ln 2 .def _start; .val -4; .scl 1; .type 04; .endef .def _end; .val -8; .scl 1; .type 04; .endef .def _n; .val -12; .scl 1; .type 05; .endef .def _time; .val -16; .scl 1; .type 05; .endef .ln 5 call _clrscr .ln 6 call _clock movl %eax,%eax movl %eax,-4(%ebp) .ln 7 movl $0,-12(%ebp) L3: LPB2: incl LPBX2+8 cmpl $999999,-12(%ebp) jle L6 LPB3: incl LPBX2+12 jmp L4 .align 4,0x90 L6: .ln 9 LPB4: incl LPBX2+16 call _sub .ln 7 L5: LPB5: incl LPBX2+20 incl -12(%ebp) jmp L3 .align 4,0x90 L4: .ln 11 LPB6: incl LPBX2+24 call _clock movl %eax,%eax movl %eax,-8(%ebp) .ln 12 movl -8(%ebp),%ebx subl -4(%ebp),%ebx movl %ebx,-16(%ebp) .ln 13 movl -16(%ebp),%eax pushl %eax pushl $LC0 call _printf addl $8,%esp .ln 14 movl -16(%ebp),%ecx movl %ecx,%eax movl $91,%ebx cltd idivl %ebx movl %eax,-16(%ebp) .ln 15 movl -16(%ebp),%eax pushl %eax pushl $LC1 call _printf addl $8,%esp .ln 16 L2: LPB7: incl LPBX2+28 .def .ef; .val .; .scl 101; .line 16; .endef movl -20(%ebp),%ebx movl %ebp,%esp popl %ebp ret .def _main; .val .; .scl -1; .endef .data .align 2 LPBX0: .long 0 .long LPBX1 .long LPBX2 .long 8 .long 0 .long LPBX3 .long 40 .long LPBX4 .long LPBX5 .long LPBX6 LPBX1: .ascii "c:/djgpp/bin/../progs/speed.d\0" .lcomm LPBX2,32 .text .align 2 LPBC0: .ascii "sub\0" LPBC1: .ascii "../progs/speed.c\0" LPBC2: .ascii "main\0" .align 2 LPBX3: .long LPB0 .long LPB1 .long LPB2 .long LPB3 .long LPB4 .long LPB5 .long LPB6 .long LPB7 LPBX4: .long LPBC0 .long LPBC2 .long LPBC2 .long LPBC2 .long LPBC2 .long LPBC2 .long LPBC2 .long LPBC2 LPBX5: .long 5 .long 8 .long 14 .long 14 .long 16 .long 14 .long 18 .long 23 LPBX6: .long LPBC1 .long LPBC1 .long LPBC1 .long LPBC1 .long LPBC1 .long LPBC1 .long LPBC1 .long LPBC1 .long LPBX3