Click here to Skip to main content
15,893,190 members
Home / Discussions / C#
   

C#

 
GeneralRe: Searching a string in a binary file using BinaryReader [modified] Pin
SimpleData11-Jul-09 8:49
SimpleData11-Jul-09 8:49 
GeneralRe: Searching a string in a binary file using BinaryReader [modified] Pin
Eddy Vluggen11-Jul-09 10:32
professionalEddy Vluggen11-Jul-09 10:32 
GeneralRe: Searching a string in a binary file using BinaryReader Pin
Luc Pattyn11-Jul-09 14:08
sitebuilderLuc Pattyn11-Jul-09 14:08 
GeneralRe: Searching a string in a binary file using BinaryReader Pin
Eddy Vluggen12-Jul-09 0:54
professionalEddy Vluggen12-Jul-09 0:54 
GeneralRe: Searching a string in a binary file using BinaryReader Pin
Luc Pattyn12-Jul-09 5:20
sitebuilderLuc Pattyn12-Jul-09 5:20 
GeneralRe: Searching a string in a binary file using BinaryReader Pin
OriginalGriff11-Jul-09 10:48
mveOriginalGriff11-Jul-09 10:48 
GeneralRe: Searching a string in a binary file using BinaryReader Pin
harold aptroot11-Jul-09 13:19
harold aptroot11-Jul-09 13:19 
QuestionTime values in arraylist Pin
Member 398136611-Jul-09 3:39
Member 398136611-Jul-09 3:39 
AnswerRe: Time values in arraylist Pin
Henry Minute11-Jul-09 3:52
Henry Minute11-Jul-09 3:52 
GeneralRe: Time values in arraylist Pin
PIEBALDconsult11-Jul-09 7:04
mvePIEBALDconsult11-Jul-09 7:04 
QuestionRe: Time values in arraylist Pin
PIEBALDconsult11-Jul-09 4:23
mvePIEBALDconsult11-Jul-09 4:23 
Questionhi.. Pin
mjawadkhatri11-Jul-09 1:30
mjawadkhatri11-Jul-09 1:30 
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 

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.