 |
|
 |
Stop advertising all your lame chat-bot stuff too! It's annoying to everyone on here. The only people that would not find this annoying, in my humblest opinion, are people that of an age group of 16 and under in years of age. Those that are just starting out to learn programming and have stumbled upon this page never hearing about ASM, C++, C# or anything and thinking you are now the greatest gift given to them. Those are the only people that would not mind the invasive way you have injected advertisements throughout your Article(s)!
STOP!
---
William.
|
|
|
|
 |
|
 |
Before reading any article I generally read all the comments for just this reason that I will give next. You have a serious problem communicating with people and I don't believe you should write any more Articles until you can fathom how to use proper people skills! Why do you have more than two different account/nick-names here on CodeProject? Your whole out-look from my perspective is that of a tiny insect plotting to kill all humans! You remind me of Plankton from Sponge Bob!!
Please, stop writing Articles; unless you grab the concept of people-skills/communication do not continue to further yourself in this path!
---
William
|
|
|
|
 |
|
 |
Searches mind thousands of individually designed mind files at www.chatbotsearch.com Lets you search through a vast network of AI chatbot mind files or TANU's (Transplantable Artificial Neurological Units) in the Chatbot! Cyber Community.
|
|
|
|
 |
|
 |
Why use COM at all?
You can make a managed C++ project, create an unmanaged function (using "#pragma unmanaged"), then wrap it with a managed function, which can be called from CLS languages like C#.
Paul
|
|
|
|
 |
|
 |
why not just call the unmanaged code directly with pinvoke:
http://www.codeproject.com/csharp/unmanage.asp
the above URL is a much more efficient example of calling unmanaged (c++ und inline assembler code) by someone who seems to have spent more time learning c# and less time advertising for AI chat bots...
|
|
|
|
 |
|
 |
Your's does not have tool tips and will not work for large projects because of it. Read the article again and just hit me up if you have any questions.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
Easly deploy your AI chatbot to ANY chatsystem: IRC networks, A8L, A8L Instant Mesasnger, y8hoo Chat, y8hoo Instant Messanger, I8Q, etc.
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
Your's does not have tool tips and will not work for large projects because of it.
This is a bit of a weird way of putting it which is only helping to confuse people I assume you are talking about parameter information.
Well in my version of Visual Studio I can see the parameter information just fine (yes, even with PInvoke or a COM interface). So I think you might be talking about something else or some particular issue - please elaborate.
Again, I am left feeling confused
dog_spawn
http://www.hatekill.com[^]
|
|
|
|
 |
|
 |
Tooltips include: auto-complete triggered by member access operators in an IDE, mouse over bubble help that shows signature info, etc. These are not possible with primitive ASM binaries. And, no you will not have tool tips if you build an ASM binary and link it into a .NET application as .net application unless you exposed standard COM or other .net recognized architecture. That would be a substantial amount of unnecessary work and would destroy the feasibility for large ASM optimizations. Anyhow, how tooltips and supporting architectures is outside the scope of this article. But just for kicks, in the ATL case, ATL generates code that exposes an interface called IDispatch as well as a direct “vtable” interface, when “duel” is selected in the ATL wizard, which is called by the target IDE (.net interop, VB6, etc.) used to generate tooltips during development of the binary’s host. Many other architectures are used by IDE’s to generate tool tips, for example when .net makes a web reference to a soap server that exposes WSDL, the WSDL is downloaded and used to generate tooltips for the SOAP server’s methods. For an example of WSDL that is used to generate tooltips in .net IDE’s see the TANU WSDL:
http://www.p2bconsortium.com/SSS/SSS.asmx?WSDL[^]
Cheers,
lonetron
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx[^]
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
Your's does not have tool tips and will not work for large projects because of it
That's just nuts. I have worked on huge projects in the past without tooltips, intellisense ballooning values and the like. And some of those huge projects were using emacs as an IDE with none of the fancy features of Visual Studio - e.g. no breakpoints, no stepping through code, no watches, and so on. If I wanted to trace through code I had to write values out to the command console.
Now, I'll be one of the first to admit that features like "tooltips" have made life a lot easier but seriously do you really think the development world will fall apart just because they don't exist.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event[^].
|
|
|
|
 |
|
 |
Because I seriously doubt that your sample is faster than doing it on pure C# or in managed C++. And I think that several other people here will have the same kind of doubt...
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
 |
|
 |
Again, read the article. You missed the ball because you just looked at the code and did not read it. This allows the speed of ASM but the power of tool tips. Only efficient in scale. If you try to load thousands of dlls written in ASM into a C# project you will fail w/o tool tips. If you have no experience in optimizing large scale projects (2 million lines or more) then this would not make sense to you. Read the article and ask a more specific question if you have one. Yes this architecture is not relevant for a typical small .com, and does not claim to be, but is the only feasible way to optimize large aerospace or medical device projects written in .net when you have both .net developers and asm algorithm developers. Again, if you try to directly link in an ASM binaries into .net then you loose tool tips. If you thousands of asm binaries to link then you will not complete your project without tool tips. I have seen anumber or large companies go under because they made the mistake of trying to directly link in “unmanaged” c or asm dll binaries into .net projects. Don’t reinvent the wheel. Use ATL so that you have the tool tips for your ASM. Another advantage to using a correct architecture like this is that you can build and link your asm, c++ and C# with only build process rather then having to user a third party assembly compiler. As far as timing tests go, It is well known basic computer science that code is can be most optimized at the ASM level. Yes there is ATL/COM overhead in this (for the sake of tooltips and being able to build w/ one build environment) so the timing benefits are only acquired when the algorithms are large enough scale to surpass the ATL/COM overhead.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
you just looked at the code and did not read it
The source file download link is broken
lonetron wrote:
This allows the speed of ASM but the power of tool tips.
I believe this is a flawed arguement
lonetron wrote:
Don’t reinvent the wheel
That statement is a tad ironic.
lonetron wrote:
As far as timing tests go, It is well known basic computer science that code is can be most optimized at the ASM level
It is insufficient to leave out benchmarks in this kind of article. People will not trust your code or techniques if you don't provide evidence. Why should we, as the readers, have to do the hard work? Even a simple test would help. Try reading some other popular articles around here and you will see examples of what the original poster is aksing for.
|
|
|
|
 |
|
 |
Thanks, link fixed.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
Again, read the article. You missed the ball because you just looked at the code and did not read it.
Actually, exactly the opposite, as your download links were not working. And I did not run it, but I bet that your sample is at least two times slower than the "pure C#" version.
lonetron wrote:
This allows the speed of ASM but the power of tool tips.
WTF this means?
lonetron wrote:
If you try to load thousands of dlls written in ASM into a C# project you will fail w/o tool tips.
Now, I know that tooltips are a fundamental mechanism on DLL loading.
lonetron wrote:
If you have no experience in optimizing large scale projects (2 million lines or more) then this would not make sense to you.
Oh, believe me, I have.
And a lesson I learned is that COM and optimization are almost mutually exclusive.
Have you ever heard about COM interception? Have you ever heard about marshalling? Have you ever heard about cross-apartment calls? Do you have any idea about the overhead of a cross-apartment COM call?
lonetron wrote:
Again, if you try to directly link in an ASM binaries into .net then you loose tool tips.
I know, and my DLLs will fail to load as you explained before.
lonetron wrote:
correct architecture
It's the first time I heard this expression: could you please explain what's a "correct architecture" to me?
lonetron wrote:
As far as timing tests go, It is well known basic computer science that code is can be most optimized at the ASM level.
And it's also well known that ASM code can be slower than compiled code, too: it depends on how well the code was written. And, in your case, I suspect that the code is not only slower, it is at least 2 times slower.
lonetron wrote:
Yes there is ATL/COM overhead in this (for the sake of tooltips and being able to build w/ one build environment)
Another wrong concept: that an IDE feature impacts the performance of my runtime code. I know, without tooltips my DLLs will fail to load.
lonetron wrote:
Yes there is ATL/COM overhead in this (for the sake of tooltips and being able to build w/ one build environment) so the timing benefits are only acquired when the algorithms are large enough scale to surpass the ATL/COM overhead.
We all know that you can use interop to call ASM code. But why use COM interop?
Why not use P/Invoke? Why not use IJW? Why not use COM from managed C++?
Tooltips? Believe me, all these techniques will bring you tooltips.
Again, some quick timings would help to convince us that your technique is faster than the obvious, more elegant and easier to write. You know, on 2 milion LOC projects, this is important.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
 |
|
 |
In short, overhead for COM Marshaling is relatively constant and algorithm complexity grows. Hence the larger the calculation the overhead of the COM marshaling time becomes smaller relative to the calculation time. Far to often coders go all out on optimization and loose things like tooltips for the sake of optimization, forgetting that the overhead of marshaling is relatively small compared to their optimized code.
O(COM Marshaling Overhead + algorithm execution time)
For example, if if the COM marshaling overhead is lets say 2 units of time and the execution time (in this example) is 0.00001 the overhead is larger then the algorithm execution time. However, if the algorithm takes 100 units of time in C# and 50 units of time in C/C++/ASM then the time to execute is 50 units of time + 2 units of time then the overall time is 52 units of time which is relatively close to 50 units of time (as would be the case of directly including an ASM DLL and skipping the COM layer and loosing tooltips) For most business needs, 2 more units of time for COM marshaling is worth the scalability advantages when their algorithms take 50 units of time.
cheers,
lonetron
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
What's the penalties for crossing managed/unmanaged code boundaries? Is it worth crossing the boundaries for such relatively small operations?
--
Hell is from here to eternity.
|
|
|
|
 |
|
 |
The COM layer it self is very slow and this architecture will not be efficient for small calculations. This is more practical for real-time embedded systems such as medical devices or aerospace where large calculations must be completed fast. Rather then being limited to C++ developers, the company can use this architecture to heir C# developers and then a few C++ developers to optimize the large algorithms in ASM. This can even more easily be done without the COM layer via linking a 100% ASM DLL into the .net project but lacks the benefits of tool tips, reference counting, deployment version control etc.
This example simply provides demonstrates C#->ATL/C++->Inline Assembly/ASM As a complex algorithm would make it less feasible for most users to understand the architecture.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
Easly deploy your AI chatbot to ANY chatsystem: IRC networks, A8L, A8L Instant Mesasnger, y8hoo Chat, y8hoo Instant Messanger, I8Q, etc.
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
The COM layer it self is very slow and this architecture will not be efficient for small calculations
The problem here is you have given a bad example. In my experience COM is not "slow". Also it is impractical to modularise very small operations. Your article and comments seem to contradict each other...
For C++, DirectX is accessed though a COM interface and it does not seem to be significantly slower than OpenGL. Is COM much slower through C# or something? I cannot say I have noticed this.
Basically I am having a hard time trying to understand what you are saying because your example is odd and the download is broken. In a nutshell, what are your conclusions?
I think you could improve the article by removing the adverts.
|
|
|
|
 |
|
 |
dog_spawn wrote:
I think you could improve the article by removing the adverts.
AI Which chat-bot adverts? tanu Where artificial do intelligent you chat-bot see P2B adverts? consortium
Finally moved to Brazil
|
|
|
|
 |
|
 |
The problem here is you have given a bad example. Right, and the aritcle states that it is a simple case for the sake of demonstration but as this is only usefull in large architectures. Its a good idea to start w/ a simple example and let others reuse the architecture for thier larger complex scenarios. COM is slow enough that in the case of adding 2 numbers, the overhead of COM binding will take longer then if the 2 numbers were added in .net However, in the case where the algorithm is large, the COM overhead will be small.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
lonetron wrote:
the aritcle states that it is a simple case for the sake of demonstration but as this is only usefull in large architectures
Yes, the article states that, but it does not prevent it from being confusing. Without a more compelling arguement backed up with a good example people like me just think to ourselves "I am going to do it the way MSDN and the c# books say". In this case that means either use COM or PInvoke (as posted above).
Consider this questions: what is the point of this article? You have think of sufficient justification before you even start writing IMO.
|
|
|
|
 |
|
 |
what is the point of this article? You have think of sufficient justification before you even start writing IMO
Good question.
As the article states:
This solution demonstrates as simply as possible how to leverage inline
assembly and C++ ATL from a C# project. This architecture may be used
to optimize .NET web service, .net web applications, .net windows
applications and .net windows services without any third party
assemblers.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
Easly deploy your AI chatbot to ANY chatsystem: IRC networks, A8L, A8L Instant Mesasnger, y8hoo Chat, y8hoo Instant Messanger, I8Q, etc.
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |
|
 |
what is the point of this article? You have think of sufficient justification before you even start writing IMO
Good question.
As the article states:
This solution demonstrates as simply as possible how to leverage inline
assembly and C++ ATL from a C# project. This architecture may be used
to optimize .NET web service, .net web applications, .net windows
applications and .net windows services without any third party
assemblers.
Free and easy AI chatbot hosting: http://www.p2bconsortium.com/sss/CreateBot.aspx
"free and easy remote hosting for AI chatbots in your chatroom even when you are away"
|
|
|
|
 |