|
since he doesn't "rail against the rich", it's unlikely he means anyone.
|
|
|
|
|
I'm so poor I can't even pay attention.
|
|
|
|
|
what????
(yes|no|maybe)*
|
|
|
|
|
I am not in that 1%, but have enough to leave without troubles and allowing me some extras from time to time, that's enough.
Don't know who told it, but I am totally agree...
Rich is not the one that has more, but the one than need less
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks for posting this. It is really eye opener.
Happy Programming
|
|
|
|
|
Pranit Kothari wrote: It is really eye opener.
It is more correctly referred to as 'blowing smoke in your eyes'
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
When I was a kid my mom always told me "finish your plate, kids are starving in Africa", and I do, I am already doing a lot! ^_^
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
At least your heart is with them.
You should have told your mom, "then why didn't you think of that before you gave me too much broccoli?"
|
|
|
|
|
I usually didn't talk back much to my mom...
Such is my hard life!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
|
I'm the 1,1%... FFFFFFFFFFFFFUUUUUUUU!!!!!!
Better find me a bank building and set up camp!
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
<0.1% for me. I think I can afford more ammo.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
|
You're an outlaw biker? 
|
|
|
|
|
In a hospital full of quadriplegics, it's like pointing out what a lucky man a paraplegic is.
Being malnourished in Appalachia is so damn lucky, too! After all, they could be starving in Ethiopia!
Accepting such bull-crap is a patently disgusting concept: defending injustice with greater injustice.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
modified 11-Mar-12 9:56am.
|
|
|
|
|
|
After Sarah Burke[^] earlier in January, today Nick Zoricic[^] died after a crash near the finish line in Switzerland.
Even with the safeties and precautions, accidents still happen.
Sad day for Canadian winter sports.
(fix'n'link)
Watched code never compiles.
modified 10-Mar-12 18:41pm.
|
|
|
|
|
That is so sad, and I hadn't heard about Sarah Burke. I grew up in Colorado and have skied almost since I could walk. Even so, watching the professional skiers has always scared the daylights out of me.
QRZ? de WAØTTN
|
|
|
|
|
FYI, your Sarah link is broken.
|
|
|
|
|
thanks.
Watched code never compiles.
|
|
|
|
|
A young waiter just had his first customer, who turned out to be a big burly truck driver. The young man walked up to the table where the truck driver was sitting and asked. "Can I take your order sir?" The truck driver replies, "Sure kid, I want three flat tires and two headlights." The young man was very puzzled and said, "I beg your pardon?" The truck driver said again, "Look kid, I want three flat tires and two headlights." The young man was still puzzled, but replied, "Yes sir."
The young man took the request to his boss who was the head cook. He told him about the truck driver's order, and that he wanted three flat tires and two headlights. "I think he's in the wrong place." The head cook said, "I know what he wants - he wants three flap jacks and two eggs sunny side up. The truck driver is just trying to be smart, I know him." The cook said to the waiter, "Here, take this bowl of beans, give it to him and say this."
On receiving the bowl of beans, the truck driver says, "Listen kid, I didn't order this - I said I wanted three flat tires and two headlights." The waiter replies, "Well sir, the head cook said while you wait for your parts, you can gas up."
/ravi
|
|
|
|
|
[EDIT2]
Oops.. completely misleading results.. test in x86 mode on my win7 machine!
Well the only conclusion C# is good ^_^, .NET4.5 is not optimized, C++ optimizer is way better
(And, BTW, .NET DLL loading is a sad source of slow .NET app startup)
[/EDIT2]
I was curious about performance and did run some test, on my Windows7 machine.
And also on a Windows 8 (consumer preview) VM machine in Virtual Box on my Windows 7 box.
In C++ I ran this test:
TC++
int primes(unsigned long n) {
unsigned long i, j;
int countprimes = 0;
for(i = 1; i <= n; i++) {
int isprime = 1;
for(j = 2; j < sqrt((double)i); j++)
if(!(i%j)) {
isprime = 0;
break;
}
countprimes+= isprime;
}
return countprimes;
}
In C# I have 2 test, one with the SQRT computed before the loop.
In C++ having sqrt called everytime or just before made no difference!!!
I suspect a compiler optimization and tried to trick the compiler with custom no inline function taking both i and j as parameters, no change... :-/
[EDIT]
Thanks Harold I was able to trick the C++ compiler!
with
static double SQRT(double x)
{
__asm
{
movsd xmm0, x
sqrtsd xmm0, xmm0
movsd x, xmm0
}
return x
}
[/EDIT]
TC#1 (Sqrt in the loop)
static int primes(int n)
{
uint i, j;
int countprimes = 0;
for (i = 1; i <= n; i++)
{
bool isprime = true;
var limit = Math.Sqrt(i);
for (j = 2; j <= Math.Sqrt(i); j++)
if ((i % j) == 0)
{
isprime = false;
break;
}
if (isprime) countprimes++;
}
return countprimes;
}
TC#2 (Sqrt before the loop)
static int primes(int n)
{
uint i, j;
int countprimes = 0;
for (i = 1; i <= n; i++)
{
bool isprime = true;
var limit = Math.Sqrt(i);
for (j = 2; j <= limit; j++)
if ((i % j) == 0)
{
isprime = false;
break;
}
if (isprime) countprimes++;
}
return countprimes;
}
Now for the times... (took the average time of a few run, with n = 1000 000)
Windows 7:
TC#1: 2780 ms (.NET4)
TC#2: 858 ms (.NET4)
TC#1: 2400 ms (.NET3.5)
TC#2: 856 ms (.NET3.5)
TC++: 286 ms
[EDIT]TC++ (inline sqrt): 1011 ms[/EDIT]
Windows 8:
TC#1: 1065 ms (.NET4)
TC#2: 296 ms (.NET4)
TC#1: 2760 ms (.NET4.5)
TC#2: 880 ms (.NET4.5)
TC++: 297 ms
For this results it appears that
1. Math.Sqrt() is slooooow
or the C++ compiler defied my attempt at preventing it optimizing
2. (.NET on) Windows 8 is fast!!! .NET4 on my VM is faster than .NET4 on the host machine!!!
3. .NET4.5 is not yet optimized...
4. WTF happened to Math.Sqrt() in .NET4??! it is slower than .NET3.5!!!?!?!
[EDIT]
5. C# is not doing too bad after all!
From some Windows Phone profiling I guess the biggest perceived performance (real) problem is DLL loading, C# is slow.. (at startup)...
[/EDIT]
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
modified 10-Mar-12 11:10am.
|
|
|
|
|
Can you show the disassembly of all these things?
Edit: I assume you know this, but just in case: throw an exception somewhere, run outside the debugger and then debug when it throws. The disassembly from code that was started with the debugger attached is useless.
Edit 2: perhaps you can trick the C++ compiler with this:
static double SQRT(double x)
{
__asm
{
movsd xmm0, x
sqrtsd xmm0, xmm0
movsd x, xmm0
}
return x;
}
modified 10-Mar-12 10:43am.
|
|
|
|
|
 It might be quite verbose.... let's just pick a few
TC++
__declspec(noinline) double fct(int i, int j)
{
01301000 push ebp
01301001 mov ebp,esp
return sqrt((double)i)
01301003 fild dword ptr [i]
}
01301006 pop ebp
return sqrt((double)i)
01301007 jmp _CIsqrt (13019B0h)
--- No source file -------------------------------------------------------------
0130100C int 3
0130100D int 3
0130100E int 3
0130100F int 3
--- c:\dev\test\perfdouble\pdouble\pdouble.cpp ---------------------------------
int primes(unsigned long n) {
01301010 push ebp
01301011 mov ebp,esp
01301013 sub esp,8
01301016 push esi
01301017 push edi
unsigned long i, j
int countprimes = 0
for(i = 1
01301018 mov edi,1
0130101D cmp ebx,edi
0130101F jb primes+55h (1301065h)
int isprime = 1
float limit = sqrt((double)i)
for(j = 2
01301021 push edi
01301022 mov esi,2
01301027 call fct (1301000h)
0130102C fcom qword ptr [__real@4000000000000000 (1302120h)]
01301032 add esp,4
01301035 fnstsw ax
01301037 test ah,41h
0130103A jne primes+4Eh (130105Eh)
if(!(i%j)) {
0130103C xor edx,edx
0130103E mov eax,edi
01301040 div eax,esi
01301042 test edx,edx
01301044 je primes+4Eh (130105Eh)
int isprime = 1
float limit = sqrt((double)i)
for(j = 2
01301046 inc esi
01301047 mov dword ptr [ebp-4],esi
0130104A fild dword ptr [ebp-4]
0130104D jns primes+45h (1301055h)
0130104F fadd qword ptr [__real@41f0000000000000 (1302118h)]
01301055 fcomp st(1)
01301057 fnstsw ax
01301059 test ah,5
0130105C jnp primes+2Ch (130103Ch)
unsigned long i, j
int countprimes = 0
for(i = 1
0130105E inc edi
int isprime = 1
float limit = sqrt((double)i)
for(j = 2
0130105F fstp st(0)
01301061 cmp edi,ebx
01301063 jbe primes+11h (1301021h)
isprime = 0
break
}
countprimes+= isprime
}
throw "break here"
01301065 push offset __TI2PAD (13022F8h)
0130106A lea ecx,[ebp-4]
0130106D push ecx
0130106E mov dword ptr [ebp-4],offset string "break here" (130210Ch)
01301075 call _CxxThrowException (13019B6h)
$LN23:
0130107A int 3
--- No source file -------------------------------------------------------------
0130107B int 3
0130107C int 3
0130107D int 3
0130107E int 3
0130107F int 3
--- c:\dev\test\perfdouble\pdouble\pdouble.cpp ---------------------------------
return countprimes
}
did the disassembly for the slow version (TC#1)
TC#1, .NET4, win7
00000000 push ebp
00000001 mov ebp,esp
00000003 push edi
00000004 push esi
00000005 sub esp,0Ch
00000008 mov dword ptr [ebp-0Ch],ecx
0000000b mov esi,1
00000010 mov eax,dword ptr [ebp-0Ch]
00000013 cdq
00000014 test edx,edx
00000016 jg 0000001F
00000018 jl 0000007B
0000001a cmp eax,1
0000001d jb 0000007B
0000001f mov edi,1
00000024 lea ecx,[edi+1]
00000027 jmp 00000038
00000029 mov eax,esi
0000002b xor edx,edx
0000002d div eax,ecx
0000002f test edx,edx
00000031 jne 00000037
00000033 xor edi,edi
00000035 jmp 00000062
00000037 inc ecx
00000038 xor eax,eax
0000003a mov dword ptr [ebp-14h],esi
0000003d mov dword ptr [ebp-10h],eax
00000040 fild qword ptr [ebp-14h]
00000043 fstp qword ptr [ebp-14h]
00000046 fld qword ptr [ebp-14h]
00000049 fsqrt
0000004b mov dword ptr [ebp-14h],ecx
0000004e mov dword ptr [ebp-10h],eax
00000051 fild qword ptr [ebp-14h]
00000054 fstp qword ptr [ebp-14h]
00000057 fld qword ptr [ebp-14h]
0000005a fcomip st,st(1)
0000005c fstp st(0)
0000005e jp 00000062
00000060 jbe 00000029
00000062 test edi,edi
00000064 je 00000066
00000066 inc esi
00000067 xor eax,eax
00000069 mov edx,dword ptr [ebp-0Ch]
0000006c mov ecx,edx
0000006e sar ecx,1Fh
00000071 cmp eax,ecx
00000073 jg 0000007B
00000075 jl 0000001F
00000077 cmp esi,edx
00000079 jbe 0000001F
0000007b mov ecx,60BDFC48h
00000080 call FFEB1E10
00000085 mov esi,eax
00000087 mov edx,182EA4h
0000008c mov ecx,70000001h
00000091 call 61524745
00000096 mov edx,eax
00000098 mov ecx,esi
0000009a call 60E023E0
0000009f mov ecx,esi
000000a1 call 61521086
000000a6 int 3
TC#1, .NET3.5, win7
00000000 push ebp
00000001 mov ebp,esp
00000003 push edi
00000004 push esi
00000005 sub esp,0Ch
00000008 mov dword ptr [ebp-0Ch],ecx
0000000b mov esi,1
00000010 mov eax,dword ptr [ebp-0Ch]
00000013 cdq
00000014 test edx,edx
00000016 jg 0000001F
00000018 jl 0000007B
0000001a cmp eax,1
0000001d jb 0000007B
0000001f mov edi,1
00000024 lea ecx,[edi+1]
00000027 jmp 00000038
00000029 mov eax,esi
0000002b xor edx,edx
0000002d div eax,ecx
0000002f test edx,edx
00000031 jne 00000037
00000033 xor edi,edi
00000035 jmp 00000062
00000037 inc ecx
00000038 xor eax,eax
0000003a mov dword ptr [ebp-14h],esi
0000003d mov dword ptr [ebp-10h],eax
00000040 fild qword ptr [ebp-14h]
00000043 fstp qword ptr [ebp-14h]
00000046 fld qword ptr [ebp-14h]
00000049 fsqrt
0000004b mov dword ptr [ebp-14h],ecx
0000004e mov dword ptr [ebp-10h],eax
00000051 fild qword ptr [ebp-14h]
00000054 fstp qword ptr [ebp-14h]
00000057 fld qword ptr [ebp-14h]
0000005a fcomip st,st(1)
0000005c fstp st(0)
0000005e jp 00000062
00000060 jbe 00000029
00000062 test edi,edi
00000064 je 00000066
00000066 inc esi
00000067 xor eax,eax
00000069 mov edx,dword ptr [ebp-0Ch]
0000006c mov ecx,edx
0000006e sar ecx,1Fh
00000071 cmp eax,ecx
00000073 jg 0000007B
00000075 jl 0000001F
00000077 cmp esi,edx
00000079 jbe 0000001F
0000007b mov ecx,66CA0D04h
00000080 call FFE41E4C
00000085 mov esi,eax
00000087 mov edx,292F2Ch
0000008c mov ecx,70000001h
00000091 call 671A9052
00000096 mov edx,eax
00000098 mov ecx,esi
0000009a call 6681A7A0
0000009f mov ecx,esi
000000a1 call 671A9187
000000a6 int 3
TC1, .NET4, win8
00000000 push rbx
00000001 push rdi
00000002 sub rsp,28h
00000006 movsxd r8,ecx
00000009 cmp r8,1
0000000d jl 0000000000000080
0000000f mov ecx,1
00000014 nop word ptr [rax+rax+00000000h]
00000020 mov eax,ecx
00000022 cvtsi2sd xmm0,rax
00000027 mov eax,2
0000002c mov eax,eax
0000002e cvtsi2sd xmm1,rax
00000033 sqrtsd xmm0,xmm0
00000037 ucomisd xmm0,xmm1
0000003b jb 000000000000006A
0000003d mov r9d,2
00000043 xor edx,edx
00000045 mov eax,ecx
00000047 div eax,r9d
0000004a test edx,edx
0000004c je 000000000000006A
0000004e inc r9d
00000051 mov eax,r9d
00000054 cvtsi2sd xmm2,rax
00000059 mov eax,ecx
0000005b cvtsi2sd xmm0,rax
00000060 sqrtsd xmm1,xmm0
00000064 ucomisd xmm1,xmm2
00000068 jae 0000000000000043
0000006a inc ecx
0000006c mov eax,ecx
0000006e cmp rax,r8
00000071 jle 0000000000000020
00000073 jmp 0000000000000080
00000075 add rsp,28h
00000079 pop rdi
0000007a pop rbx
0000007b ret
0000007c nop dword ptr [rax]
00000080 lea rdx,[FFEE2D70h]
00000087 mov ecx,70000001h
0000008c call 000000005F7A0A70
00000091 mov rbx,rax
00000094 lea rcx,[5E8109F0h]
0000009b call 000000005F682310
000000a0 mov rdi,rax
000000a3 mov rdx,rbx
000000a6 mov rcx,rdi
000000a9 call 000000005ED99BC0
000000ae mov rcx,rdi
000000b1 call 000000005F79EF24
000000b6 nop
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Well there's your problem - it's running in 64bit mode on win8 and in 32bit mode on win7. I wouldn't have expected a difference this large, but you're not exactly comparing apples to apples here..
|
|
|
|
|