PlasmaBomb
Lifer
- Nov 19, 2004
- 11,636
- 2
- 81
Now the cpu forum has its own version of fleabag.
<---- Grabs chair and popcorn.
How long till he is banned?
Or maybe this is a fleabag alt account
Now the cpu forum has its own version of fleabag.
<---- Grabs chair and popcorn.
Just because they're saying negative things doesn't make them trolls. Also, there *is* a programming forum if you'd like to discuss your idea there.
this should have been posted in the programming forum....
i already did, in less than 10 lines. i didnt output to a .txt file b/c that's not necessary.
Code:int main() { int c, time = GetTickCount(); for(int i=1; i<10000; i++)c = sqrt(i * i + i * i); time -= GetTickCount(); cout << time; return 0; }
Why not?
gettickcount is good for very small time measurement. for this code it would overlap itself several times.
then decrease the number of iterations. it'll be linear. no point in having it write a 10k line text file.
meh. there are some libraries that will give you low level access to time but i dont really feel like taking it that far if the user cant even notice the difference.
Back in 1990, my micro prof told my class that all computers on the planet could be connected all together if everyone started using UNIX.
Of course, my buddies and I, despite our love for machine language, just laughed at him. We chose Wing Commander and Ultima, over UNIX.
I believe if we really want to save electricity, then we can't use any MULTIPURPOSE DEVICES, e.g., game consoles to play games, word processor or business computers for businesses, 1-2 seater car for carpool, ban SUV & minivans, ban any vehicles older than 10yrs or less than 20MPG combined, etc. Basically, only specific purpose devices to do specific tasks, and only efficient specific purpose devices are allowed.
Of course, this is not possible since it violates human rights and the spirit of freedom.
it is not just about saving electricity. it is more about efficiency. for someone who writes programs which are used by relatively few people and not so often, it does't make a differece what language is used. But window is used by so many people and it is runnig the moment you turn on the computer having faster code makes good sense.
meh. there are some libraries that will give you low level access to time but i dont really feel like taking it that far if the user cant even notice the difference.
I just took a look at it. it would be good to know what point you want to make.
I could what? Where did I mention how much hardware we use? Hardware is dirt cheap. Cycles are dirt cheap. Disk space is dirt cheap. Bandwidth is dirt cheap. You know what isn't dirt cheap? Time and talent.
It's more than good enough. It's a perfect fit for what we needed to build. Your question of "how can we make this better/faster/more efficient" is not a bad question to ask, but you're creating the question to justify your preexisting answer. So I'll repeat myself: nothing about this system would have been "better/faster/more efficient" in any meaningful way if it had been written in an unmanaged language. Nothing. Yet, you would have decided to use the unmanaged language in the beginning, without even considering whether the project required it, because you assume it will be better.
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
TITLE c:\Users\aphorism\documents\visual studio 2010\Projects\....
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
PUBLIC ?isqrt@@YAHH@Z ; isqrt
PUBLIC __real@3fc00000
PUBLIC __real@3f000000
EXTRN __fltused:DWORD
; COMDAT __real@3fc00000
; File c:\users\aphorism\documents\visual studio 2010\projects\....
CONST SEGMENT
__real@3fc00000 DD 03fc00000r ; 1.5
CONST ENDS
; COMDAT __real@3f000000
CONST SEGMENT
__real@3f000000 DD 03f000000r ; 0.5
; Function compile flags: /Ogtp
CONST ENDS
; COMDAT ?isqrt@@YAHH@Z
_TEXT SEGMENT
_x$ = -4 ; size = 4
_rr$ = -4 ; size = 4
?isqrt@@YAHH@Z PROC ; isqrt, COMDAT
; _r$ = edx
; Line 20
push ebp
mov ebp, esp
push ecx
; Line 25
movss xmm5, DWORD PTR __real@3f000000
; Line 28
movss xmm4, DWORD PTR __real@3fc00000
xorps xmm3, xmm3
cvtsi2ss xmm3, edx
movss DWORD PTR _rr$[ebp], xmm3
mov eax, -1100021760 ; be6f0000H
sub eax, DWORD PTR _rr$[ebp]
movaps xmm2, xmm3
shr eax, 1
mov DWORD PTR _x$[ebp], eax
movss xmm1, DWORD PTR _x$[ebp]
movaps xmm6, xmm1
movaps xmm0, xmm1
mulss xmm6, xmm1
mulss xmm2, xmm5
mulss xmm1, xmm2
mulss xmm0, xmm4
mulss xmm6, xmm1
subss xmm0, xmm6
; Line 29
cmp edx, 101123 ; 00018b03H
jle SHORT $LN1@isqrt
movaps xmm1, xmm0
mulss xmm1, xmm4
movaps xmm4, xmm0
mulss xmm4, xmm0
mulss xmm0, xmm2
mulss xmm4, xmm0
subss xmm1, xmm4
movaps xmm0, xmm1
$LN1@isqrt:
; Line 30
mulss xmm0, xmm3
addss xmm0, xmm5
cvttss2si ecx, xmm0
; Line 31
mov eax, 1
sub eax, ecx
imul eax, ecx
add eax, edx
sar eax, 31 ; 0000001fH
; Line 32
mov esp, ebp
pop ebp
ret 0
?isqrt@@YAHH@Z ENDP ; isqrt
_TEXT ENDS
PUBLIC _main
; Function compile flags: /Ogtp
; COMDAT _main
_TEXT SEGMENT
_main PROC ; COMDAT
; Line 17
xor eax, eax
; Line 18
ret 0
_main ENDP
_TEXT ENDS
END
cycles arent cheap for all applications. i really dont know about you but i need more compute power. hardware companies would not bother making faster hardware if it wasnt needed. they wouldnt spend time on things like avx or sse either.
3² + 4² = 5² = 25
4² + 3² = 5² = 25
5² + 12² = 13² = 169
6² + 8² = 10² = 100
7² + 24² = 25² = 625
and you go on until a and b reach 10000
ok?
The kernel is still going to be millions of lines isn't it?
If you change or optimise something there is always the possibility that it will break something else, which means it will take ages to implement.
That bit of redundant code you thought was redundant didn't turn out to be so redundant after all...
Edit: Yeah even linux kernels have surpassed 10 million lines of code... good luck with Win7!
that's not my point. i'm saying a financially sound company is not going to spend exponentially more money for minuscule gains in throughput. it's not smart business.
and the biggest bottleneck in applications is and will always be user interaction. who cares if you shave off a couple of ms if the user still has to spend 20 minutes using it?
