Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »C# sample program for Leve1Socket
Author Topic: C# sample program for Leve1Socket (6 messages, Page 1 of 1)

Lav2018
-Interested User-
Posts: 10
Joined: Mar 15, 2018


Posted: Apr 4, 2018 08:55 PM          Msg. 1 of 6
I've found all of the sample C# programs very helpful and the comments make for easy following. I have one question about the Level1Socket program.

In Level1SocketForm.cs, lines 201-202 are:

 
// move on to the next message. This isn't very efficient but it is simple (which is the focus of this example).
sData = sData.Substring(sLine.Length + 1);


Do you have any examples showing more efficient ways? If not, can you please point me towards a better solution. Thank you.

DTN_Tim Walter
-DTN Guru-
Posts: 1238
Joined: Apr 25, 2006


Posted: Apr 5, 2018 08:06 AM          Msg. 2 of 6
You would want to do something that doesn't involve creating additional strings whenever possible. Anything that does a string copy like this can be costly. I did some looking and substring and split both have this kind of behavior, so I would probably look into MemoryStreams or a StringReader as possible alternatives, but I have not done any testing of those options to confirm their performance.

https://msdn.microsoft.com/en-us/library/system.io.stringreader(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.io.memorystream(v=vs.110).aspx

Tim

Lav2018
-Interested User-
Posts: 10
Joined: Mar 15, 2018


Posted: Apr 5, 2018 02:51 PM          Msg. 3 of 6
Makes sense. Thanks.

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 18, 2018 06:43 AM          Msg. 4 of 6
Hello Lav2018,

Please have a look to my open source C# IQFeed client.

https://github.com/mathpaquette/IQFeed.CSharpApiClient

Your feedbacks are welcome!
Mathieu

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 18, 2018 07:14 AM          Msg. 5 of 6
Well, I'm still skeptical about the real performance benefit of not using .Split. I'll do some performance tests to conclude on this.

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 22, 2018 08:06 PM          Msg. 6 of 6
 

 

Time: Fri July 26, 2024 7:21 PM CFBB v1.2.0 12 ms.
© AderSoftware 2002-2003