Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
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 
Hi there,

I have a StreamEvent from a StockExchange Data Provider API. The Event is triggered every time a new price occurs for the respective Instrument on the Exchange.

I can fill the Stream with multiple Intruments, lets say 50.000. So the StreamEvent is triggered about mutiple thousand times in one second.

In the Stream, I first check the price difference in percent between the last price and the new one:

private double abw;
void TPBrief_Brief(int SymbolNr, float NewPrice, float Volume, DateTime Time)
        {
            abw = (((InstrumentObject)os[SymbolNr]).LastPrice - NewPrice) / (((InstrumentObject)os[SymbolNr]).LastPrice/ 100);
            if (abw >= 1.5) {//do whatever}
            // rest of code
        }


As you can see, I hold my Instrument Objects in a Hashtable, key is Symbolnr, value the InstrumentObject. The first line in this event is the one which is triggered that often, so I just want to know how to optimize this line.

As I learned from various articles, Hashtable should be replaced with a Dictionary, this is one thing I will do.

But what about this variation:
void TPBrief_Brief(int SymbolNr, float NewPrice, float Volume, DateTime Time)
        {
            IntrumentObject io = ((InstrumentObject)os[SymbolNr]);
            abw = (io.LastPrice - NewPrice) / (io.LastPrice/ 100);
            if (abw >= 1.5) {//do whatever}
            // rest of code
        }


Could this be faster than the first one? What's about the Calculation of the difference? Can this code fragment be optimized?

Any help would be appreciated!
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 
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 

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.