Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array on the heap

Status
Not open for further replies.

OOzy

Programmer
Jul 24, 2000
135
SA
Hi Gurus

How can I create 15 element array on the heap then sort it?

OOzy
 
sorry, one mistake
but XOR command is faster. John Fill
1c.bmp


ivfmd@mail.md
 
Hello John.

Which compiler did you used to produce this code?

It seems like your 'swap_xor()' is indeed more
efficient than the 'swap_mov()' your compiler generates.

The interesting thing is: When I replace the code from my two functions by the inline code of your previous post, the swap_mov() method is... faster. I am surprised, but maybe it has something to do with the Pentium 'pipelined' processing/caching or whatever. If you have enough time: Could you please run my program on your machine and post the results? It would be interesting to know.

regards,
-- ralf
 
I'm using VisualC++6. But what I said is right only for inline function. And not always :) John Fill
1c.bmp


ivfmd@mail.md
 
>But what I said is right only for inline function. And not always :)

I tested it once again. On my machine, the xor-function (inline) is able to swap two integers ~ 300000000 times per second, while the mov-function does this ~ 330000000 times.
This shows me: This is _no_ real difference. Let's stop this discussion here (- although I enjoyed it -) as long as someone needs a program that has to swap one gazillion or more integers. ;)

-- ralf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top