-
December 23rd, 2006, 02:24 PM
#31
Re: C# vs C++ in server apps
Originally Posted by greg_dolley
Arjay, and in MC++ it gets even easier! Check it out:
Code:
MessageQueue ^mq = gcnew MessageQueue("DestinationQueueName");
mq->Send(gcnew Message("my message"));
Greg Dolley
Ah, but the using block in C# is freeing the queue resources. Is the using statement available in mC++?
-
December 23rd, 2006, 05:27 PM
#32
Re: C# vs C++ in server apps
Exterminator, I discorvered it when doing a comparative analysis of the code generators back in 2002. The anomoly has since been mitigated to a large degree, but it is an important reminder that just because all .Net languages generate MSIL, they do not generate the same sequences.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 24th, 2006, 12:52 AM
#33
Re: C# vs C++ in server apps
Sorry for repeating myself, but I really would like an answer to my question (that's why I started the thread )
I've currently have a server application with 3 tcp servers (using iocp), a connection to a PBX, a number of db connections (through odbc). The server is a queue system which directs calls, emails, sms:es to the correct agent with the help of skill based routing.
I'm currently using an own developed XML protocol to send information to/from the agents. Which means that I have to serialize/unserialize the objects myself before sending them using tcp/ip (have build a small nifty framework for this). I using both a regular client/server architecture (client sends a request and the server response) and server pushes (server need to send information to all clients when new calls/emails/sms arrive / are being updated). Everything is sent on the same socket (some of our clients have very strict policies with firewalls between the server and clients).
Is .Net remoting the way to go, or should I solve it with tcp servers?
Would everything work in .net or would I get unwanted delays?
"The making of software, like the making of sausages, should never be watched."
http://blog.gauffin.org - .NET Coding/Architecture
-
December 24th, 2006, 01:24 AM
#34
Re: C# vs C++ in server apps
I cannot comment on few of the points in your post but here are a few inputs.
Regarding Databasing, you should not face any issues. Moreover, you would not need to make an ODBC connection as such. ADO.NET is quite efficient and can handle your requirements quite easily. What I am not sure is what you mean by number of connections. Do you have multiple databases or connection pooling for concurrent database access in multiple threads? It is better to leave those issues to databases and ADO.NET connection pooling and just manage transactions client side. There a number of techniques available both at the backend database as well as client side. You should not have an issue as far as I know. Plus if you making a lot of connections and closing them frequently, you can have a disconnected data set and operate on that and periodically hit the db for the update. That would help performance.. which is inbuilt with ADO.NET and you would have had to do that yourself writing code otherwise.
Regarding serialization and XML : It should not be an issue as well.
Socket programming shouldn't be an issue as well probably because they use the underlying windows api's. Remoting gives you a lot of flexibility. I don't have much experience with these though.
But as far as I know, you should not have any worries but I would like to suggest you to read up on the various .NET components you would be exploiting to achieve your task and understand the working. This is your project, you know better. Which sections are performance critical for you and could be a bottleneck. Also, post on the C# forum to get better response.
I have a question though, why do you want a re-write?
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
December 24th, 2006, 01:35 AM
#35
Re: C# vs C++ in server apps
I'm going to develop a similiar product from scratch and I'm thinking of doing it in C# instead of C++.
Ohh.. Another thing. Is it possible to create plugins to a .Net application in C++?
"The making of software, like the making of sausages, should never be watched."
http://blog.gauffin.org - .NET Coding/Architecture
-
December 24th, 2006, 02:10 AM
#36
Re: C# vs C++ in server apps
Originally Posted by Arjay
This reminds me of back in the day where performance of STL was compared with hand written code. Sometimes the speed improvement that hand written code offered over STL was necessary; however, the vast majority of the time the extra 5% improvement wasn't required or even noticeable and it sure was nice to work in STL.
Arjay, remember there are different implementations of STL, written by different companies. Their class structures, function parameters, etc. are all the same, but how the functions are coded is different. Microsoft licensed a certain STL implementation from a third party company (I forgot the name). HP wrote the very first implementation of STL starting in 1993.
The version of STL that comes with VC++ 6.0, IMHO, is terribly slow compared to stuff I've written in the past. One time I had to make my own list class. It wasn't supposed to run fast, just had to be written quickly. I threw together some really dirty code; it was just meant for a prototype, never to be reused. This class stored the list items in one flat array. Every time an item was added, an entirely new array was created with one element more than the old array. All data was copied over from the old to the new array plus the new element. Finally, the old array was freed. Really inefficient, right? Yeah, I thought it was going to be much slower than STL's list class (which uses a linked list internally so no big blocks of memory need to be allocated or copied). But believe it or not, my crappy list class ran nine (yes, nine!) times faster than STL's list! I was using my list class in a custom grid control in order to store the rows of the grid. I was shocked.
Greg Dolley
-
December 24th, 2006, 02:42 AM
#37
Re: C# vs C++ in server apps
Originally Posted by greg_dolley
But believe it or not, my crappy list class ran nine (yes, nine!) times faster than STL's list! I was using my list class in a custom grid control in order to store the rows of the grid. I was shocked.
Well. That depends on how you are using your class. The STL implementation (linked list) should be faster if you have loads of inserts but a few reads. A regular array would be faster if you have few inserts and lots of reads. Using it for a grid sounds like a few inserts and many reads.
Anyway, it´s a bit offtopic. The thread is about how .net performs in a server app compared to c++
"The making of software, like the making of sausages, should never be watched."
http://blog.gauffin.org - .NET Coding/Architecture
-
December 24th, 2006, 01:56 PM
#38
Re: C# vs C++ in server apps
This IS a fascinating discussion, and there is ALSO a question pending from the start of this thread.
A few of my posts have drawn debate on various points, and since my 5 year old's holiday preparations have the entire family busy, me included, I've not responded quickly....
...but I'll be back!
Sometimes I've posted while my son is interrupting me with requests for help (he gets into some bridge building project and insists I assist) - which interrupts my train of thought - I can see I've left a few passages hanging....
l'll come back when I have a little time to devote to more clear thought - I sense a great many people are asking themselves about this topic, and it splits into a great many tributaries.
I've been pleasantly surprised at how well C# performs, and at the gravity people feel when drawn to it.
-
December 24th, 2006, 02:18 PM
#39
Re: C# vs C++ in server apps
Originally Posted by Arjay
Ah, but the using block in C# is freeing the queue resources. Is the using statement available in mC++?
I haven't seen it, but you could have easily done this in order to free the queue resources:
Code:
{
MessageQueue ^mq = gcnew MessageQueue("DestinationQueueName");
mq->Send(gcnew Message("my message"));
}
Now the mq object will get freed after Send().
Greg Dolley
-
December 24th, 2006, 02:20 PM
#40
Re: C# vs C++ in server apps
Originally Posted by verifier
I'm going to develop a similiar product from scratch and I'm thinking of doing it in C# instead of C++.
Ohh.. Another thing. Is it possible to create plugins to a .Net application in C++?
Yes, it's possible to do it in MC++.
Greg Dolley
-
December 24th, 2006, 02:33 PM
#41
Re: C# vs C++ in server apps
Originally Posted by greg_dolley
Microsoft licensed a certain STL implementation from a third party company (I forgot the name). HP wrote the very first implementation of STL starting in 1993.
Dinkumware/ PJ Plauger?
Originally Posted by greg_dolley
The version of STL that comes with VC++ 6.0, IMHO, is terribly slow compared to stuff I've written in the past. One time I had to make my own list class. It wasn't supposed to run fast, just had to be written quickly. I threw together some really dirty code; it was just meant for a prototype, never to be reused. This class stored the list items in one flat array. Every time an item was added, an entirely new array was created with one element more than the old array. All data was copied over from the old to the new array plus the new element. Finally, the old array was freed. Really inefficient, right? Yeah, I thought it was going to be much slower than STL's list class (which uses a linked list internally so no big blocks of memory need to be allocated or copied). But believe it or not, my crappy list class ran nine (yes, nine!) times faster than STL's list! I was using my list class in a custom grid control in order to store the rows of the grid. I was shocked.
Well, I must also say that I am shocked. I am pretty sure that you did not time the efficiencies right and that you chose the wrong container. If your implementation was more efficient, then std::list was a wrong choice! You should have had chosen std::vector/std:eque. I am open to proofs.. (you may want to take this up in a new thread in the non-visual c++ forum).
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
January 1st, 2007, 02:10 PM
#42
Re: C# vs C++ in server apps
Originally Posted by TheCPUWizard
As an example, did you know that in .NEt 1.1, VB.Net could be up to 100 times faster than C#??
Do get back to this it was for-loop functtion call for all non interal type:
Code:
for (double alpha=0.123; alpha <120; a+= 0.001)
The C# coded two (virtual iirc, it's been years) fuunction calls, VB just banged the FPU.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|