Здравствуйте, Философ, Вы писали:
Ф> R>Ну, сильно изменился общий результат?
Ф> Для начала расскажи как запускал. Есть серьёзное подозрение, что под дебаггером.
Сборка в релиз (оптимизация O3 + отключение рантайм проверок), запуск из командной строки.
Не изменилась картина, правда? То-то же. Нефиг было гнать на GetTickCount.
Ф> ...покажи что там компилятор паскали наоптимизировал.
Асм процедуры TestSpeedIntX<Int64>:
C:\FPC\fpcupdeluxe\projects\project1.lpr:21 begin
00000001000018B0 53 push rbx
00000001000018B1 57 push rdi
00000001000018B2 56 push rsi
00000001000018B3 4154 push r12
00000001000018B5 4155 push r13
00000001000018B7 4156 push r14
00000001000018B9 4157 push r15
00000001000018BB 488D642490 lea rsp,[rsp-$70]
C:\FPC\fpcupdeluxe\projects\project1.lpr:22 a := 0;
00000001000018C0 48C744246800000000 mov qword ptr [rsp+$68],$00000000
C:\FPC\fpcupdeluxe\projects\project1.lpr:23 b := 0;
00000001000018C9 4531FF xor r15d,r15d
C:\FPC\fpcupdeluxe\projects\project1.lpr:24 c := 0;
00000001000018CC 4531F6 xor r14d,r14d
C:\FPC\fpcupdeluxe\projects\project1.lpr:25 d := 0;
00000001000018CF 31DB xor ebx,ebx
C:\FPC\fpcupdeluxe\projects\project1.lpr:26 e := 0;
00000001000018D1 31F6 xor esi,esi
C:\FPC\fpcupdeluxe\projects\project1.lpr:27 f := 0;
00000001000018D3 31FF xor edi,edi
C:\FPC\fpcupdeluxe\projects\project1.lpr:28 g := 0;
00000001000018D5 4531E4 xor r12d,r12d
C:\FPC\fpcupdeluxe\projects\project1.lpr:29 h := 0;
00000001000018D8 4531ED xor r13d,r13d
C:\FPC\fpcupdeluxe\projects\project1.lpr:30 VariablesIncrementTime := GetTickCount;
00000001000018DB E860FEFFFF call -$000001A0
00000001000018E0 4889442460 mov [rsp+$60],rax
C:\FPC\fpcupdeluxe\projects\project1.lpr:31 for i := 1 to Iterations do
00000001000018E5 B880969800 mov eax,$00989680
00000001000018EA 660F1F440000 nop word ptr [rax+rax+$00]
C:\FPC\fpcupdeluxe\projects\project1.lpr:33 Inc(a);
00000001000018F0 488344246801 add qword ptr [rsp+$68],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:34 Inc(b);
00000001000018F6 4983C701 add r15,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:35 Inc(c);
00000001000018FA 4983C601 add r14,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:36 Inc(d);
00000001000018FE 4883C301 add rbx,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:37 Inc(e);
0000000100001902 4883C601 add rsi,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:38 Inc(f);
0000000100001906 4883C701 add rdi,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:39 Inc(g);
000000010000190A 4983C401 add r12,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:40 Inc(h);
000000010000190E 4983C501 add r13,$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:31 for i := 1 to Iterations do
0000000100001912 4883E801 sub rax,$01
0000000100001916 75D8 jnz -$28
C:\FPC\fpcupdeluxe\projects\project1.lpr:42 VariablesIncrementTime := GetTickCount - VariablesIncrementTime;
0000000100001918 E823FEFFFF call -$000001DD
000000010000191D 4889C6 mov rsi,rax
0000000100001920 482B742460 sub rsi,[rsp+$60]
C:\FPC\fpcupdeluxe\projects\project1.lpr:44 ArrayItemIncrementTime := GetTickCount;
0000000100001925 E816FEFFFF call -$000001EA
000000010000192A 4889C7 mov rdi,rax
C:\FPC\fpcupdeluxe\projects\project1.lpr:45 for i := 1 to Iterations do
000000010000192D B880969800 mov eax,$00989680
0000000100001932 660F1F440000 nop word ptr [rax+rax+$00]
C:\FPC\fpcupdeluxe\projects\project1.lpr:47 Inc(SmallArray[0]);
0000000100001938 488344242001 add qword ptr [rsp+$20],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:48 Inc(SmallArray[1]);
000000010000193E 488344242801 add qword ptr [rsp+$28],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:49 Inc(SmallArray[2]);
0000000100001944 488344243001 add qword ptr [rsp+$30],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:50 Inc(SmallArray[3]);
000000010000194A 488344243801 add qword ptr [rsp+$38],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:51 Inc(SmallArray[4]);
0000000100001950 488344244001 add qword ptr [rsp+$40],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:52 Inc(SmallArray[5]);
0000000100001956 488344244801 add qword ptr [rsp+$48],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:53 Inc(SmallArray[6]);
000000010000195C 488344245001 add qword ptr [rsp+$50],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:54 Inc(SmallArray[7]);
0000000100001962 488344245801 add qword ptr [rsp+$58],$01
C:\FPC\fpcupdeluxe\projects\project1.lpr:45 for i := 1 to Iterations do
0000000100001968 4883E801 sub rax,$01
000000010000196C 75CA jnz -$36
C:\FPC\fpcupdeluxe\projects\project1.lpr:56 ArrayItemIncrementTime := GetTickCount - ArrayItemIncrementTime;
000000010000196E E8CDFDFFFF call -$00000233
0000000100001973 4889C3 mov rbx,rax
0000000100001976 4829FB sub rbx,rdi
C:\FPC\fpcupdeluxe\projects\project1.lpr:58 WriteLn('elapsed for variable = ', VariablesIncrementTime, ' array = ', ArrayItemIncrementTime);
0000000100001979 E882A60000 call +$0000A682
000000010000197E 4889C7 mov rdi,rax
0000000100001981 4C8D0590760100 lea r8,[rip+$00017690]
0000000100001988 4889C2 mov rdx,rax
000000010000198B 31C9 xor ecx,ecx
000000010000198D E88EA80000 call +$0000A88E
0000000100001992 E849690000 call +$00006949
0000000100001997 4889FA mov rdx,rdi
000000010000199A 4989F0 mov r8,rsi
000000010000199D 31C9 xor ecx,ecx
000000010000199F E8FCAA0000 call +$0000AAFC
00000001000019A4 E837690000 call +$00006937
00000001000019A9 4C8D0588760100 lea r8,[rip+$00017688]
00000001000019B0 4889FA mov rdx,rdi
00000001000019B3 31C9 xor ecx,ecx
00000001000019B5 E866A80000 call +$0000A866
00000001000019BA E821690000 call +$00006921
00000001000019BF 4889FA mov rdx,rdi
00000001000019C2 4989D8 mov r8,rbx
00000001000019C5 31C9 xor ecx,ecx
00000001000019C7 E8D4AA0000 call +$0000AAD4
00000001000019CC E80F690000 call +$0000690F
00000001000019D1 4889F9 mov rcx,rdi
00000001000019D4 E897A70000 call +$0000A797
00000001000019D9 E802690000 call +$00006902
C:\FPC\fpcupdeluxe\projects\project1.lpr:59 end;
00000001000019DE 90 nop
00000001000019DF 488D642470 lea rsp,[rsp+$70]
00000001000019E4 415F pop r15
00000001000019E6 415E pop r14
00000001000019E8 415D pop r13
00000001000019EA 415C pop r12
00000001000019EC 5E pop rsi
00000001000019ED 5F pop rdi
00000001000019EE 5B pop rbx
00000001000019EF C3 ret