Click here to Skip to main content
15,886,676 members
Home / Discussions / C#
   

C#

 
AnswerRe: hi.. Pin
OriginalGriff11-Jul-09 1:42
mveOriginalGriff11-Jul-09 1:42 
AnswerRe: hi.. Pin
Christian Graus11-Jul-09 2:15
protectorChristian Graus11-Jul-09 2:15 
GeneralRe: hi.. Pin
EliottA11-Jul-09 18:40
EliottA11-Jul-09 18:40 
GeneralRe: hi.. Pin
Baeltazor12-Jul-09 2:52
Baeltazor12-Jul-09 2:52 
QuestionSpeed up performance Pin
gehbitte11-Jul-09 0:55
gehbitte11-Jul-09 0:55 
AnswerRe: Speed up performance Pin
Henry Minute11-Jul-09 1:03
Henry Minute11-Jul-09 1:03 
AnswerRe: Speed up performance Pin
Nicholas Butler11-Jul-09 1:38
sitebuilderNicholas Butler11-Jul-09 1:38 
GeneralRe: Speed up performance [modified] Pin
gehbitte11-Jul-09 2:23
gehbitte11-Jul-09 2:23 
Thank you for your input. The Calculation of the Percentage is a good one Smile | :)

I tested now the calculation with this different algos:

private void StreamEventHash(int SymbolNr, float NewPrice, float Volume, DateTime Zeit_kurs)
       {
            abw = (((OSObject)osHash[SymbolNr]).LastPrice - NewPrice) / (((OSObject)osHash[SymbolNr]).LastPrice / 100);
            if (abw >= 5)
            {
            }
       }
       private void StreamEventHashNewObject(int SymbolNr, float Kurs, float Volume, DateTime Zeit_kurs)
       {
           OSObject oo = ((OSObject)osHash[SymbolNr]);
           abw = (oo.LastPrice - NewPrice) / (oo.LastPrice / 100);
           if (abw >= 5)
           {
           }
       }
       private void StreamEventHashNewObjectAs(int SymbolNr, float Kurs, float Volume, DateTime Zeit_kurs)
       {
           OSObject oo = osHash[SymbolNr] as OSObject;
           abw = (oo.LastPrice - NewPrice) / (oo.LastPrice / 100);
           if (abw >= 5)
           {
           }
       }


I use the stopwatch class for this. I found out that the first one is the slowest Smile | :) So there is performance optimization possible.

But I can't tell which one of the other 2 algos are faster, because when I change the order the voids are tested, different results occur. It seems that the one which is tested first is always a little bit slower. I am about to figure out how to get reliable results, maybe to run the tests multiple times in random order.

And than I have to find out what your proposed algo

abw = NewPrice / io.LastPrice;
if ( abw >= 1.015 || abw <= 0.985 ) { // do whatever }


will do Smile | :)

modified on Saturday, July 11, 2009 8:31 AM

GeneralRe: Speed up performance Pin
harold aptroot11-Jul-09 2:33
harold aptroot11-Jul-09 2:33 
GeneralRe: Speed up performance [modified] Pin
gehbitte11-Jul-09 2:49
gehbitte11-Jul-09 2:49 
GeneralRe: Speed up performance Pin
harold aptroot11-Jul-09 3:10
harold aptroot11-Jul-09 3:10 
AnswerRe: Speed up performance Pin
gehbitte11-Jul-09 4:31
gehbitte11-Jul-09 4:31 
Questioncode to invoke start bttuon Pin
Vivek Vijayan10-Jul-09 23:23
Vivek Vijayan10-Jul-09 23:23 
AnswerRe: code to invoke start bttuon Pin
Enver Maroshi11-Jul-09 0:14
Enver Maroshi11-Jul-09 0:14 
GeneralRe: code to invoke start bttuon Pin
Vivek Vijayan11-Jul-09 16:50
Vivek Vijayan11-Jul-09 16:50 
GeneralRe: code to invoke start bttuon Pin
Vivek Vijayan11-Jul-09 16:52
Vivek Vijayan11-Jul-09 16:52 
Questionpicturebox help Pin
mjawadkhatri10-Jul-09 22:44
mjawadkhatri10-Jul-09 22:44 
AnswerRe: picturebox help Pin
Rajesh R Subramanian10-Jul-09 22:57
professionalRajesh R Subramanian10-Jul-09 22:57 
GeneralRe: picturebox help Pin
mjawadkhatri11-Jul-09 0:29
mjawadkhatri11-Jul-09 0:29 
GeneralRe: picturebox help Pin
Henry Minute11-Jul-09 0:32
Henry Minute11-Jul-09 0:32 
GeneralRe: picturebox help Pin
mjawadkhatri11-Jul-09 0:43
mjawadkhatri11-Jul-09 0:43 
GeneralRe: picturebox help Pin
Henry Minute11-Jul-09 0:56
Henry Minute11-Jul-09 0:56 
GeneralRe: picturebox help Pin
Christian Graus11-Jul-09 2:16
protectorChristian Graus11-Jul-09 2:16 
QuestionSome C# + windows mobile question Pin
E_Gold10-Jul-09 21:23
E_Gold10-Jul-09 21:23 
QuestionSending email without smtp server Pin
The_Collector10-Jul-09 20:40
The_Collector10-Jul-09 20:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.