I'm a C# developer by trade and currently in the end-phase of a total rewrite from C# to C++ for this project in order to get it running cross-platform as well as increase performance.
This is my first C++ project and any feedback is welcome!
Why to C++? What kind of performance problems did you see beforehand? And isn't C# probably viable for cross-plattform, especially with Microsoft opening the .NET ecosystem up more and more? (I don't want to suggest that you did anything wrong, I'm genuinely curious)
I'm gonna try to address everything at once here :)
(Private) trackers are very picky about what clients they allow. This leaves me with few alternatives when it comes to BitTorrent libraries, Rasterbar-libtorrent being one of them. Rasterbar-libtorrent is awesome, and written in C++.
I wrote a C++/CLI wrapper for libtorrent to bridge the native/managed gap and did the rest of the work in pure C#. Awesome, except C++/CLI is not cross-platform and will not be made cross-platform in the MS CoreCLR releases. So to become cross-platform, I either have to rewrite everything in C++, or use P/Invoke. I never got the P/Invoke stuff to work well with the C++ nature of libtorrent, which left me with a C++ rewrite of Hadouken.
As it turns out, C++11 is quite pleasant to work with, and with the Poco framework I actually made some real progress quite fast. I also ran a Ubuntu VM on my Windows dev-machine to make sure everything worked smoothly as I went along.
Performance may have been the wrong word, maybe I should've used memory usage, but I'm currently in the finishing stages of having it running on the older R-Pi boards, so even though 90% of the users will run it on some sort of desktop/server machine, some will run it on the R-Pi where memory is limited.
In what regard? I only have numbers for Windows, and mostly memory-based numbers which will vary depending on load. Here's some recent numbers I pulled,
- It idles at ~1.5-1.8MB with no torrents.
- With 10 seeding torrents, it runs at ~3.8-4MB memory usage.
However, these numbers may or may not run true depending on usage and workload.
Don't forget that low-end servers that make great low-cost bittorrent machines also often have very limited memory (512Mb or even 256Mb RAM for a cheap VPS are not uncommon). I am very pleased that you take memory use into consideration.
10 comments
[ 4.2 ms ] story [ 37.3 ms ] threadI'm a C# developer by trade and currently in the end-phase of a total rewrite from C# to C++ for this project in order to get it running cross-platform as well as increase performance.
This is my first C++ project and any feedback is welcome!
regards and good works :)
https://github.com/hadouken/hadouken/wiki/Getting-started-on...
(Private) trackers are very picky about what clients they allow. This leaves me with few alternatives when it comes to BitTorrent libraries, Rasterbar-libtorrent being one of them. Rasterbar-libtorrent is awesome, and written in C++.
I wrote a C++/CLI wrapper for libtorrent to bridge the native/managed gap and did the rest of the work in pure C#. Awesome, except C++/CLI is not cross-platform and will not be made cross-platform in the MS CoreCLR releases. So to become cross-platform, I either have to rewrite everything in C++, or use P/Invoke. I never got the P/Invoke stuff to work well with the C++ nature of libtorrent, which left me with a C++ rewrite of Hadouken.
As it turns out, C++11 is quite pleasant to work with, and with the Poco framework I actually made some real progress quite fast. I also ran a Ubuntu VM on my Windows dev-machine to make sure everything worked smoothly as I went along.
Performance may have been the wrong word, maybe I should've used memory usage, but I'm currently in the finishing stages of having it running on the older R-Pi boards, so even though 90% of the users will run it on some sort of desktop/server machine, some will run it on the R-Pi where memory is limited.
- It idles at ~1.5-1.8MB with no torrents.
- With 10 seeding torrents, it runs at ~3.8-4MB memory usage.
However, these numbers may or may not run true depending on usage and workload.