Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!cadre!pitt!darth!apex!gary From: gary@apex.UUCP (Gary Wisniewski) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: MSC 4.0 -> MSC 5.0 conversion experiences Message-ID: <312@apex.UUCP> Date: Sat, 21-Nov-87 01:14:34 EST Article-I.D.: apex.312 Posted: Sat Nov 21 01:14:34 1987 Date-Received: Mon, 23-Nov-87 05:01:39 EST Organization: Apex Software Corp., Pittsburgh, Pa. Lines: 186 Summary: Conversion summary with some statistics Xref: mnetor comp.sys.ibm.pc:10392 comp.lang.c:5513 I converted our product from MSC 4.0 to MSC 5.0 this evening and thought I'd make a quantitative report of my findings. I'd be curious to hear what everyone else's experiences turn out to be. The program converted: FrontRunner. A TSR database product compatible with dBASE III+. There are about 50000 lines of code, written in C and assembler. Assembler accounts for about 6000 of those lines. FrontRunner is an interpreter, but creates pseudo-compiled code internally. Pseudo-code is reverse-polish stack-oriented. Functions vary widely in size, but an average is 75 lines. Code is well written with register declarations and function prototypes. Most functions use pascal calling sequence with near call optimizations when possible. Memory model is `medium'. I wrote my own memory allocator which is slightly slower than MSC but less than half the size. The code works well and there are very few loose ends (the product is currently on the market). The process of conversion: I had to make some (very minor) command line adjustments. I also had to change about 20 references to memcpy() to the equivalent memmove(). memcpy() now works differently. We have our own startup code which is substantially the same as MSC ... no conversion was required there. All in all ... conversion was straightforward and the product appears to work identically under both compiler versions. Total elapsed time for conversion (including compiler installation): 5.5 hrs. Strange happenings: I got an internal compiler from "emit.c" when it hit the line: qtraverse[qmac[qx]++]; Changing it to the following fixed it: qtraverse[qmac[qx]]; qmac[qx]++; Compilation details: Memory model: medium Command options: /Osal /Gs /Zd /AM /Zp /FPa /DLINT_ARGS Link options: /map/noi/li/noe Results; execution speed: Execution speed appears to have increased. A very quick benchmark test yielded about an 8% increase. The following dBASE program was executed under both versions: i = 0 ? time() do while i < 10000 i = i + 1 enddo ? time() MSC 4.0 running time: 41 seconds MSC 5.0 running time: 38 seconds (8% improvement) The program is converted to byte-codes and executed by a byte-code interpreter. All values are floating point. Results; space: I was a bit disappointed, since we were hoping for a space improvement more than anything else: MSC 4.0 image size after loading: 166064 bytes MSC 5.0 image size after loading: 167712 bytes (1% loss) All code was identical, except for memmove substitution and the qmac++ change necessary to avoid the code generation bug. Here is a detailed summary of how the code and data segment sizes stack up. Most entries represent individual modules. Those marked with an asterisk are libraries which contain multiple modules. Object Size Segment Class 5.0 vs. 4.0 MSC4.0 MSC5.0 00696H 006D4H FRONT_TEXT CODE LARGER 002FFH 002EEH INTER_TEXT CODE SMALLER 00214H 00210H CMDEVAL_TEXT CODE SMALLER 006B5H 006EAH CMDPARSE_TEXT CODE LARGER 00019H 0001AH CTERROR_TEXT CODE LARGER 00037H 00032H DBGLOBAL_TEXT CODE SMALLER 0017FH 00192H DBREC_TEXT CODE LARGER 000C7H 000B6H ENVMGR_TEXT CODE SMALLER 009B8H 009B8H PRGEXEC_TEXT CODE SAME 0056BH 0055EH DOFILE_TEXT CODE SMALLER 0003EH 00042H ERRMSG_TEXT CODE LARGER *0733CH 078FCH _TEXT CODE LARGER (MSC runtime library) 0008EH 00088H SHOWTERM_TEXT CODE SMALLER 0001AH 00014H SETERR_TEXT CODE SMALLER 01031H 00FE6H CMD_A_TEXT CODE SMALLER 001DAH 001E0H CMD_ACPT_TEXT CODE LARGER 000EAH 000E2H CMD_CLOS_TEXT CODE SMALLER 001E0H 001D8H CMD_CMD_TEXT CODE SMALLER 00257H 00244H CMD_INDX_TEXT CODE SMALLER 002CAH 002B8H CMD_DIR_TEXT CODE SMALLER 0046FH 004E0H CMD_DISP_TEXT CODE LARGER 00146H 00148H CMD_FIND_TEXT CODE LARGER 000C2H 000C6H CMD_GOTO_TEXT CODE LARGER 0013AH 00136H CMD_LOCA_TEXT CODE SMALLER 0008EH 0008EH CMD_Q_TEXT CODE SAME 00B1BH 00B4CH CMD_SET_TEXT CODE LARGER 00094H 00096H CMD_SHOW_TEXT CODE LARGER 00084H 00082H CMD_SKIP_TEXT CODE SMALLER 00188H 0019EH CMD_STOR_TEXT CODE LARGER 001F8H 001F6H CMD_USE_TEXT CODE SMALLER 00299H 00280H CMD_DO_TEXT CODE SMALLER 001E0H 001D6H CMD_PAST_TEXT CODE SMALLER 0003DH 0003EH CMD_SELE_TEXT CODE LARGER 00104H 00108H CMD_REPL_TEXT CODE LARGER 004A5H 00490H CMD_FILE_TEXT CODE SMALLER 00059H 00058H CMD_APND_TEXT CODE SMALLER 00078H 00076H CMD_COMP_TEXT CODE SMALLER 000B3H 000B4H FRBI_TEXT CODE LARGER 000C8H 000C8H FRBO_TEXT CODE SAME 002AEH 002A4H CMD_AVER_TEXT CODE SMALLER 0020BH 0024EH CMDUTIL_TEXT CODE LARGER 000A2H 000A2H CMD_COUN_TEXT CODE SAME 00435H 0043AH SYNONYM_TEXT CODE LARGER 0006CH 00078H CMD_PUB_TEXT CODE LARGER 00049H 0004AH CMD_RLSE_TEXT CODE LARGER 000B0H 000BAH STATES_TEXT CODE LARGER 000F8H 000F8H CMD_DELE_TEXT CODE SAME 0002EH 0002EH CMD_ZERO_TEXT CODE SAME 0016BH 00184H DBGETKEY_TEXT CODE LARGER 0011EH 0011CH SERIAL_TEXT CODE SMALLER 0007AH 0007CH CMD_SOUN_TEXT CODE LARGER 00091H 00094H DISPSTAT_TEXT CODE LARGER *00F99H 00F7AH UTILS_TEXT CODE SMALLER *007B6H 007B0H SCOPE_TEXT CODE SMALLER *0191FH 01924H DBHLI_TEXT CODE LARGER 001B4H 001AAH EFILES_TEXT CODE SMALLER 0011AH 00118H EALIAS_TEXT CODE SMALLER 00026H 00024H AUXFILE_TEXT CODE SMALLER 00082H 00082H EPATHS_TEXT CODE SAME 0002CH 0002CH DBKEYS_TEXT CODE SAME 0002EH 0002EH DBTODBK_TEXT CODE SAME *0528BH 051F2H PARSER_TEXT CODE SMALLER *01CDEH 01C58H WINDOW_TEXT CODE SMALLER 00083H 00096H MPOOLI_TEXT CODE LARGER 0005EH 0005EH REALLOC_TEXT CODE SAME 00021H 00022H MEMAVL_TEXT CODE LARGER 00030H 00036H FREECT_TEXT CODE LARGER 00000H 00000H C_ETEXT ENDCODE 00036H 00042H NULL BEGDATA 03884H 02198H _DATA DATA 0000EH 0000EH CDATA DATA 00070H 017ACH CONST CONST 00008H 00008H HDR MSG 000D1H 00176H MSG MSG 00002H 00027H PAD MSG 00001H 00001H EPAD MSG 006E2H 006E2H _BSS BSS 00BACH 00BACH c_common BSS 02000H 02000H STACK STACK Compared to Turbo C (warning: subjective material follows) About 2 months ago we went through the same exercize with Turbo C. Again, we were hoping for space reduction. Here is my recollection of the results: Conversion time: 10 hours Speed: Improved by about 5% Space: Reduced by about 8% Problems: Many bugs We scrapped the Turbo conversion, mostly because the product was not yet reliable. MSC is much more solid as it comes out of the box. Turbo seemed to achieve greater space reduction. There were more changes to make, of course, but both conversions were relatively easy. Turbo ASM conversions weren't bad either. Gary J Wisniewski Apex Software Corporation uucp: {allegra,bellcore,cadre}!pitt!darth!apex!gary phone: (412) 681-4343