|
You need to learn not just this. And all the bitwise operators are so basic that you need to learn them before doing any work. I strongly suggest you have no unknown parts of the language and basic technologies before you try to publish anything at all. I already criticized your code and explained why it has no benefits and why such things should be avoided. Redundant code makes redundant publication.
Thank you for understanding.
—SA
Sergey A Kryukov
|
|
|
|
|
Your code sample is better because it does not use unsafe . But it is still redundant. For further detail, please see my other comment.
Thank you.
&dashSA;Sergey A Kryukov
modified 5-Aug-24 0:22am.
|
|
|
|
|
Thanks for your comment. Can you please post your solution?
|
|
|
|
|
My solution is already posted. This is one code line in my comment and a reference to the documentation page. Isn't it enough?
—SASergey A Kryukov
modified 5-Aug-24 0:23am.
|
|
|
|
|
Can you provide one using actual code, not just a reference to to a microsoft built-in, preferably using unsafe code if you could please.
modified 5-Aug-24 1:02am.
|
|
|
|
|
charles henington wrote: Can you provide one using actual code...
Sorry, do you think it is really necessary? It would be just one line. The documentation is self-explanatory, and you can look at the code examples. I think absolutely any CodeProject member is capable of writing this line and using the method. This is just one call.
The same goes for benchmarks. It is simply not interesting to bother too much. Would you suggest that any post of the purely educated developers should be tested for performance? Believe me, you won't get any miracles. If you want to defend the code of the author of the article or your code, you are the one who is responsible for benchmarks. But don't think that you can spark any serious interest with this information. There are a lot of much more essential problems where the performance needs a lot more attention.
Thank you.
—SASergey A Kryukov
|
|
|
|
|
|
Thanks for your response. I was hoping that you would give a specific implementation of the generic method so that benchmark tests could be run on the three methods. I can write my own version but your implementation may be more exemplary than mine. With regard to your reference to the documentation page and the question, 'Isn't it enough?'. Could I refer you to the solution guide lines point 4? "Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid." That's brilliant advice and I suggest that we all follow it.
|
|
|
|
|
George Swan wrote: Could I refer you to the solution guide lines point 4? Sorry, your argument is not adequate to the situation. Recommendation #4 addresses a particular problem: people who ask questions could have read a manual already and still could not get it, so they need additional clarifications and code samples. This is how the recommendation explains it. In our case, this is not a manual, but a standard documentation page, and nobody asked questions.
Perhaps I did not understand you, though. Do you have a problem using System.Array.ConvertAll ? Then you need to ask a question, indeed. But still, the answer does not require writing any code sample for you, just because you can find the Example section on the same references page. Please use the example code. It is nearly impossible to write a more illustrative code example. If you cannot understand how it works, then ask a question, I'll gladly answer. But you would need to specify what lines of code you failed to understand. However, something tells me that you can understand everything yourself.
Thank you for understanding.
—SASergey A Kryukov
|
|
|
|
|
Sergey,
Charles did ask a perfectly fair and respectful question "Can you provide one using actual code, not just a reference to a microsoft built-in, preferably using unsafe code if you could please." Your response referred him to the documentation page. That clearly runs contrary to item 4 of the guidelines. However, the most pertinent section lies in the corollary to item 4,"Let's work to help developers, not make them feel stupid." It's difficult to reconcile that sentiment with responses that are entitled "Pretty Bad" and "Still not good enough." Surely, positive criticism and encouragement is preferable to polemic posts with derogatory titles.
|
|
|
|
|
You cannot impress anyone with this kind of argument, missing the point and not responding to the arguments of your opponent. Sorry, but it makes the discussion useless. Also, you use manipulative trick to make you opponent guilty.
For example, why this quote?
George Swan wrote: Let's work to help developers, not make them feel stupid. This is you who may make someone feel stupid, not me. I referred the code sample you needed, anyone can read it and ask further questions. I actually answered your question “where is a code sample?” I respect the person who may need some help on this matter because I assume that person can follow the link I provided, locate the sample on that page, and ask me questions if something is not quite clear. But you insist that I should publish a code sample myself. As a matter of fact, you insist on unethical behavior, because reposting or contamination CodeProject with unnecessary code is not a very nice thing.
Nevertheless, you keep ignoring the fact that I actually provided a code sample with an exact link to it and keep blaming me for not respecting the readers, when I really respect them, and you do not. It does look like a manipulation, and I hope it is not intentional.
Thank you.
—SASergey A Kryukov
|
|
|
|
|
Evidence based opinion is not a manipulative trick it's best practice. What really is manipulative is the use of down votes to discourage any poster that has the temerity to voice a contrary opinion. I do not believe that you are participating in that sort of vindictive behaviour, Sergey. But I have to ask because my responses to your posts immediately attract a down vote of -16 points from a single high status individual. So, at the risk of incurring yet another -16 points, I will post this and end the discussion. You may not get an up vote from me but you can rest assured that you will never get a down vote. You have kindly pointed out some of my faults and I have many; but indulging in denigrating punitive nonsense is not one of them.
|
|
|
|
|
Up-votes, down-votes… emotional stuff. I am responsive to technical and scientific evidence, that's it. When people provide it, I always admit my mistakes, in all cases, no matter who my opponent was. I would kindly ask you to keep it in mind. Be assured of my respect.
Thank you.
—SASergey A Kryukov
|
|
|
|
|
After a few test, Array.ConvertAll should be avoided. extremely slow, much like using GetPixel/SetPixel on a Bitmap.
|
|
|
|
|
Many of the current graduates have limited (often zero) real world experience. They can write working code for a school project, but they do not have the skills needed to scale this up to real world projects. Even if they will not admit it (even under torture ), articles like these are useful to them.
Thanks for posting.
__________________
Lord, grant me the serenity to accept that there are some things I just can’t keep up with, the determination to keep up with the things I must keep up with, and the wisdom to find a good RSS feed from someone who keeps up with what I’d like to, but just don’t have the damn bandwidth to handle right now.
© 2009, Rex Hammock
|
|
|
|
|
Thanks JB, I hope they're able to find it useful. Just as simple convert to float[] via float* changing length to data/4.
|
|
|
|
|
Many of the tips and tricks that we learned early in our careers (sometimes the hard way) are not taught in school. Projects are relatively simple and streight0-forward. Maybe we need a forum for "beginner" questions.
__________________
Lord, grant me the serenity to accept that there are some things I just can’t keep up with, the determination to keep up with the things I must keep up with, and the wisdom to find a good RSS feed from someone who keeps up with what I’d like to, but just don’t have the damn bandwidth to handle right now.
© 2009, Rex Hammock
|
|
|
|
|
Useful? You are right, but not in this case. This particular article has a negative value. I explained it in my other comment.
Thank you.
—SASergey A Kryukov
|
|
|
|
|
Technically, it is pretty useful. Ubuntu using unsafe is much faster by almost 30s at 500mb of data plus you always see questions asking how to use unsafe code as well.
|
|
|
|
|
Sorry, no. In your argument, you use an incorrect polemic trick: shifting the subject. Yes, unsafe can be a key for some considerable performance gain. But not in this particular case.
Using a standard library function for such a simple case almost always guarantees the best performance possible. And yes, internally, it can use lower-level programming, but is still can help you to avoid unsafe for your assembly using it.
I already explained why the article has a negative value. First of all, this is a contamination of code.
Thank you for understanding
—SASergey A Kryukov
|
|
|
|
|