Appendix a shell sorting test
First, the comparison table:
The first chapter of the sedensed test results mentioned in the first section are as follows: ┌ - ─ ─ ────────────────── ─ │ item │ C │ Group language │ ├──────────────────── ─ │ 式 长 长 │ 1,363 bytes│ 3,581 bytes│ │ Performing Program Length │ 69, 345 Bytes │ 803 BYTES│ │ Programming Time │ 20 hours │ 80 hours │ │ 8,000 Pen │ 30 second │ 8 second │ │48,000 Pen │ 640KB, unforgettable │ 70 second │ └───── ─ ┴─ ──────────────────
When the combination language is handled in a large amount of data, the application is flexible, and the C language is unable to execute by the current system space due to spatial limit. Test time: September 12 to 18, 1989. Participants: Zhang Danquan, Duan Xuguang, Li Chaolhui. Use models: IBM PS / 2-50, 80286 CPU, 8MHz. Use language: C and a combination language. Because other languages are unqualified, only the two are selected. Treatment Object: 48,000 Chinese phrases, are taken from 12 data files, respectively. There are 4,000 phrases per gear. Each phrase has one to five Chinese characters. Each Chinese word comprises two cells. All materials account for 316,421 characters. Sort by: Align in the alphabet of the bust. For efficiency, the Shell sequencing method is used.
Second, the production of combined languages:
1: CG Segment 2: Assume CS: CG, DS: CG, ES: CG 3: ORG 100H 4: Start: 5: MOV AX, CS 6: MOV DS, AX 7: MOV SI, 130; point to input buffer 8 : MOV BL, [Si-2] 9: DEC BX 10: SUB BH, BH 11: MOV [BX] [Si], BH 12: CLD 13: MOV DX, SI 14: MOV AX, 3D00H 15: INT 21H; Open Source 16: JNC ZStart 17: MOV DX, OFFSET ZSTR1; If there is no this file, exit 18: MOV AH, 9 19: INT 21h 20: INT 20H 21: ZStart: 22: Mov BX, AX 23: Sub DX, DX 24: MOV CX, 8000H 25: MOV BP, 4D00H 26: MOV DS, BP 27: Zread: 28: Mov Ah, 3FH; Langcho 29: Int 21h 30: OR AX, AX 31: JZ Zrend 32: MOV AX , DS; not finished, rereading 33: Add Ax, 800h 34: Mov DS, AX 35: JMP Zread 3 6: Zrend: 37: Mov Ah, 3EH; 郎 38: Int 21h 39: Mov AX, 2400H 40: Mov ES, AX 41: SUB DI, DI 42: SUB SI, SI 43: MOV DS, BP 44: SUB BP, BP 45: ZC1: 46: Call Zchgseg 47: MOV CX, 5;
Will be long-lived to be equal length 48: ZC3: 49: Lodsw 50: CMP Al, 0DH 51: JZ ZC4 52: Stosw 53: Loop ZC3 54: Inc Si 55: Inc Si 56: JMP Short ZC5 57: ZC4: 58 : MOV AX, 2020H 59: Rep Stosw 60: ZC5: 61: Inc BP 62: LODSB 63: DEC SI 64: CMP Al, 1AH 65: JNZ ZC1 66: Stosb 67: MOV CS: ZBW2, BP; BP is the data count 68: Call Zsort; Sort 69: Call ZDEL; Delete the same 70: Call ZTR; exchange for inequality 71: MOV Si, DX 72: SUB CX, CX 73: Push CS 74: Pop DS 75: MOV DX, Offset ZFCB; Archive 76: Mov Ah, 3ch 77: Int 21H 78: MOV BX, AX 79: MOV AX, 2400H 80: MOV DS, AX 81: SUB DX, DX 82: OR Si, Si 83: JZ ZC7 84: MOV CX, 80 00h 85: ZC6: 86: MOV AH, 40H 87: INT 21H 88: MOV AX, DS 89: AX, 800H 90: MOV DS, AX 91: DEC SI 92: JNZ ZC6 93: ZC7: 94: MOV CX, Di 95: Mov Ah, 40h 96: Int 21h 97: Mov Ah, 3EH 98: INT 21H 99: INT 20H 100: Zsort:
Sedimentation sub-formal 101: SHR BP, 1 102: ZS0: 103: Push BP 104: MOV CS: ZBW1, BP 105: MOV AX, CS: ZBW2 106: SUB AX, BP 107: MOV DX, BP 108: MOV BP, AX 109: MOV DI, 2400H 110: MOV DS, DI 111: SUB Si, Si 112: Call Zfindes 113: Add BX, DI 114: MOV ES, BX 115: MOV DI, AX 116: SUB DX, DX 117: ZS1 : 118: Call Zcomps 119: Jbe Zs4 120: Call ZXCHG 121: Push DS 122: Push ES 123: Push Si 124: Push Di 125: Push DX 126: ZS2: 127: MOV DI, SI 128: MOV AX, DS 129 : Mov ES, AX 130: SUB DX, CS: ZBW1 131: JC ZS3 132: Call Zfindes 133: Mov Si, AX 134: ADD BX, 2400H 135: MOV DS, BX 136: Call Zcomps 137: JBE ZS3 138: CALL ZXCHG 139: JMP ZS2 140: POP DX 142: POP DI 143: POP SI 144: POP ES 145: POP DS 146: ZS4: 147: Add Si, 10 148: JS ZS7 149: ZS5: 150: Add Di, 10 151 : JS ZS8 152: ZS6: 153: Inc DX 154: CMP DX, BP 155: JNZ ZS1 156: POP BP 157: SHR BP, 1 158: JNZ ZS0 159: RET 160: ZS7: 161: SUB SI, 8000H 162: AX, DS 163: Add Ax, 800H 164: MOV DS, AX 165: JMP ZS5 166: ZS8: 167: SUB DI, 8000H 168: MOV AX, ES 169: AX, 800H 170: Mov ES, AX 171: JMP ZS6 172: ZFindes:
173: SUB BX, BX 174: MOV AX, DX 175: SHL AX, 1 176: RCL BX, 1 177: SHL AX, 1 178: RCL BX, 1 179: Add Ax, DX 180: ADC BX, 0 181: SHL AX, 1 182: RCL BX, 1 183: Push AX 184: MOV CL, 4 185: SHR AX, CL 186: MOV CL, 12 187: SHL BX, CL 188: Add BX, AX 189: POP AX 190: And AX, 15 191: Ret 192: Zxchg: 193: Mov CL, 5 194: Zxchg1: 195: Lodsw 196: Mov BX, ES: [Di] 197: Stosw 198: MOV [Si-2], BX 199: loop ZXCHG1 200: Sub Si, 10202: Ret 203: Zcomps: 204: MOV CL, 5 205: MOV AX, DI 206: MOV BX, Si 207: REPZ CMPSB 208: MOV SI, BX 209: MOV DI, AX 210: RET 211: ZTR:;
Change the waiting for a large string 212: MOV AX, 2400H 213: MOV DS, AX 214: Mov ES, AX 215: SUB Si, Si 216: MOV DI, SI 217: MOV BP, CS: ZBW2 218: MOV DX, SI 219: ZTR1: 220: MOV CL, 5 221: Lodsw 222: CMP AX, 2020H 223: JNZ ZTR21 224: ADD SI, 8 225: DEC BP 226: JMP ZTR1 227: ZTR2: 228: Lodsw 229: CMP AX Ztr3 231: Ztr21: 232: Stosw 233: Ztr3: 234: Loop Ztr2 235: Mov AX, 0A0DH 236: Stosw 237: DEC BP 238: JZ ZTR4 239: Call Zchgseg 240: JMP ZTR1 241: ZTR4 : 242: Mov Al, 1AH 243: Stosb 244: Ret 245: zchgseg:; Sub-sub-formula 246: OR Si, Si 247: JNS ZCH1 248: SUB SI, BX 249: MOV AX, DS 250: Add Ax, 800h 251 : MOV DS, AX 252: ZCH1: 2 53: OR DI, DI 254: JNS ZCH2 255: SUB DI, BX 256: MOV AX, ES 257: AX, 800H 258: MOV ES, AX 259: Inc DX 260: ZCH2: 261: Ret 262: ZDEL:
Delete the same string 263: Mov AX, 2400H 264: Mov DS, AX 265: Mov ES, AX 266: Sub Si, Si 267: MOV DI, 10 268: MOV BP, CS: ZBW2 269: MOV BX, 8000H 270: ZDEL1: 271: DEC BP 272: JZ ZCH2 273: MOV AX, Si 274: Push di 275: MOV CL, 10 276: REPZ CMPSB 277: POP DI 278: MOV SI, AX 279: JNZ ZDEL2 280: MOV AX, 2020H 281: MOV [Si], AX 282: ZDEL2: 283: Add Si, 10 284: Call Zchgseg 286: JMP ZDEL1 287: ZBW1 DW 0 288: ZFCB DB 'YRRR', 0 290: ZSTR1 DB 'File Not Found! $' 291: CG Ends 292: End Start This parameter, with 80 hours, the source program is 3,581 characters, the execution program is 803 characters. Execute 48,000 phrase sorting, it takes 70 seconds. And after the C language written, 48,000 phrases cannot be processed, and I have been tried to 8,000, c talents. Use a combined language program to test, only 8 seconds.
Third, C language production process:
We use the same method to use C writing as follows: 1: # include
65:} 66:} 67: 68: STRCMP (V1, V2) 69: UNSIGNED CHAR * V1, * V2; 70: {71: / * Printf ("Enter strcmp / n"); * / 72: for * V1 == * V2; V1 , V2 ) 73: if (* v1 == '/ n') 74: return (0); 75: Return (* V1 - * v2); 76:} This parameter is designed The production is completed, only for 20 hours. However, when testing, spent a lot of time, spending hardware, and always could not operate the system, because the data is not enough. Finally, you must delete the data to 8,000, just run success, it takes 30 seconds.