Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
23rd July 2016, 18:20 | #21 | Link | |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
Algorithms are developed in very high level scripting dynamic languages like Matlab and Python, and then ported to c/c++ for performance reasons |
|
24th July 2016, 02:36 | #22 | Link | |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Quote:
There is no such thing as "nobody". If I was to design a complicated algorithm, I would first do it in a high-level language like... pen and paper. Then transcribe it into C# or C++ depending on the needs. |
|
24th July 2016, 02:50 | #23 | Link | |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
A quick search in Google showed the pros/cons of Python over C#. Nowhere it mentions it being a better language for mathematical algorithms; it's just a simpler language, kind of like Visual Basic used to be. That simplicity also comes at a small performance cost compared to C#. It's often more compared to JavaScript.
The learning curve for C# is quite steep but once you know it it's a simple language to use. Quote:
To be clear: this thread is not about which language is better than any other, but about how to make the best use of C#. As to which language is best, my answer is simple: the one you're familiar with.
__________________
FrameRateConverter | AvisynthShader | AvsFilterNet | Natural Grounding Player with Yin Media Encoder, 432hz Player, Powerliminals Player and Audio Video Muxer Last edited by MysteryX; 24th July 2016 at 03:05. |
|
24th July 2016, 04:23 | #24 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
It's really not as bad as I thought regarding C# for raw math processing.
First, C# does support raw pointers when compiling with /unsafe. Second, SIMD-optimized vector types have been added in .NET 4.6 Someone may have to take some time to develop a SIMD-optimized sample using raw pointers and comparing the performance with C++. |
24th July 2016, 04:44 | #25 | Link | |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
https://en.wikipedia.org/wiki/NumPy https://github.com/gwpy/gwpy |
|
24th July 2016, 05:10 | #27 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
The scientific community is a whole other community than the programming community, so it's possible that they favor Python; but I'm not part of the scientific community.
SciPy and NumPy have however been ported to .NET and are options to be explored. Does this have SIMD optimization? How does this compare to SIMD-optimized .NET types? https://www.infoq.com/news/2011/07/NumPy-NET http://pytools.codeplex.com/wikipage...y%20for%20.Net
__________________
FrameRateConverter | AvisynthShader | AvsFilterNet | Natural Grounding Player with Yin Media Encoder, 432hz Player, Powerliminals Player and Audio Video Muxer Last edited by MysteryX; 24th July 2016 at 05:12. |
24th July 2016, 05:25 | #28 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
then you're trolling, first you mentioned about "advanced neural network algorithm, or some sort of AI, for highly advanced processing", which are obviously scientific (algorithm developing) topics, then you said "You're not part of the scientific community" so you don't really give a, so what's the point?
people write prototype of the algorithm in scripting languages, and then port the prototype to a lower level language (c or c++ or stuff like that) and get a performance boost, they simply don't merge the "developing" stage and "porting" stage as one cuz that's gonna be a mess |
24th July 2016, 06:00 | #29 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
It's not more difficult to program it in C# than in Python if you're using the same core processing library.
The difference is that Python is easier to get started with. Thus, for people whose primary job is not programming, it is easier to use. For someone who already knows C#, then there's no point in first doing it in Python. C# is a lot simpler and clearer than C++. Also, if C# can provide good SIMD performance using either Python Tools or SIMD data types, then it would make it a whole lot easier to optimize code properly. C++ intrinsics have a few downside: - Complicated to use and require deep knowledge of assembly - The same code must be written several times: CPU, SSE2, AVX, etc. - Very difficult to maintain and/or debug - If AVX SIMD is used, the DLL must be compiled for AVX and will fail on other CPUs; thus several DLL versions have to be produced. Very unpractical for deployment. - Most importantly, I can't write it myself If one of the C# options can provide performance that isn't too far, but with a *much* simpler syntax, it would allow for SIMD optimization in many places where it wouldn't be done otherwise.
__________________
FrameRateConverter | AvisynthShader | AvsFilterNet | Natural Grounding Player with Yin Media Encoder, 432hz Player, Powerliminals Player and Audio Video Muxer Last edited by MysteryX; 24th July 2016 at 06:30. |
25th July 2016, 18:00 | #30 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Nowhere can I read that SciPy and NumPy have SIMD optimization, so SIMD-enabled vector types are the way to go.
|
18th August 2016, 14:33 | #31 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Here's something else interesting I found. It is possible to embed a C++ DLL within a C# DLL. This would allow the simplicity of C# while also being able to use C++ assembly without requiring a separate DLL. The best of both worlds!
http://stackoverflow.com/questions/6...ed-c-sharp-dll https://github.com/Fody/Costura So in practice, one can do it in C#, and if later he wants to add assembly optimization, it can also be done. |
19th August 2016, 09:50 | #32 | Link | |
Registered User
Join Date: Mar 2011
Posts: 59
|
Quote:
CLR needs to extract the embedded native DLL somewhere (Windows needs to have a file for the DLL to load it - it cannot load an image from raw memory) (via http://stackoverflow.com/questions/6...ed-c-sharp-dll ) So even if you want to do DLLception and save 1 DLL, you'll need to extract the C++ part when you use it, leaving you with 2 DLLs, which is no saving at all. |
|
19th August 2016, 10:38 | #33 | Link |
warpsharpened
Join Date: Feb 2007
Posts: 787
|
If it's well written I don't think it should be any more difficult to maintain or debug provided equal knowledge in the languages used.
If you're writing custom assembly/intrinsics you have the ability to do dispatching or use function pointers. It's not difficult to do runtime CPU detection. |
19th August 2016, 12:18 | #34 | Link | |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Quote:
https://github.com/Fody/Costura Chikuzen did that for some of my code. CPU detection for SSE2, and for AVX, it still required a separate DLL compilation. |
|
19th August 2016, 12:55 | #35 | Link | |
typo lover
Join Date: May 2009
Posts: 595
|
Quote:
I'll send a patch in weekend.
__________________
my repositories |
|
19th August 2016, 18:22 | #37 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
__________________
my repositories |
1st September 2016, 17:03 | #39 | Link | |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
http://stackoverflow.com/questions/2...can-while-mono
SIMD support is from RyuJIT which currently only works for x64. For Avisynth we clearly need code that works on both x86 and x64. Utility functions are very easy to write with C#, but for functions doing CPU-intensive operations on the frames, C++ is still best; unless C# allows easy SIMD integration. Quote:
Until then, the best option is C++ or C# with an embedded C++ library to do the raw frame processing operations. |
|
Tags |
.net, avisynth, filter |
|
|