A
AiryDiscus
Guest
I can see your mind is made up. Good day.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Heck, Prof. Dijkstra has been talking about semaphores and other concepts since 1950's or 60's. All the usual programming languages have support for these features. And, Javascript missing out on these rather makes it not a proper programming language.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Heck, Prof. Dijkstra has been talking about semaphores and other concepts since 1950's or 60's. All the usual programming languages have support for these features. And, Javascript missing out on these rather makes it not a proper programming language.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Heck, Prof. Dijkstra has been talking about semaphores and other concepts since 1950's or 60's. All the usual programming languages have support for these features. And, Javascript missing out on these rather makes it not a proper programming language.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Heck, Prof. Dijkstra has been talking about semaphores and other concepts since 1950's or 60's. All the usual programming languages have support for these features. And, Javascript missing out on these rather makes it not a proper programming language.
Well you wanted to know the (lack of) features that make Javascript bad. In any case the little support by Javascript in multithreading - locking, wait states, mutexes, semaphores, barriers, etc., IMHO, disqualify it from being a proper and modern language.I can see your mind is made up. Good day.
Heck, Prof. Dijkstra has been talking about semaphores and other concepts since 1950's or 60's. All the usual programming languages have support for these features. And, Javascript missing out on these rather makes it not a proper programming language.
It's got syntax. You can write very complex programs.Excel is a data analysis tool, not a programming languageWouldn't that be Excel?Panning javascript as terrible isn't exactly a balanced perspective. Whether you like it or not, it is by an order of magnitude the most popular programming language.![]()
![]()
I once wrote a complete Monte Carlo financial model for a school, with 20 year projections and lots of what-if's. I did use a plug in from these folks to make the job easier.
It's very easy to write Excel code that runs, but produces wrong answers, and it's often difficult to find the bugs. Another problem is that I don't think that most Excel users think they are programming, and inadequately test their code.
http://www.forbes.com/sites/timwors...angerous-software-on-the-planet/#2ced7e2372ae
Is Scratch a programming language? I think it is.
Jim
Could not agree more. My 2 cents on this discussion regarding interpreted languages centered around easily vectorized data structures, e.g., MATLAB/Octave, but also Python with NumPy and such:I wrote a jpeg decoder for MATLAB that used 70-ish seconds for a 1 megapixel image. Some tasks are inherently difficult to implement efficiently using a matrix algebra/JIT/... oriented framework. Mathworks have done many such things in C/Fortran and exposed the function as a native MATLAB function (often depending themselves on 3rd party libraries). You can do the same using using the mex wrapping.
I think that what you are saying is a general thing: if you break your algorithm into a "pipeline" of small memory-to-memory operations, even if those operations are individually optimized to run as fast as physically possible on a piece of hardware, the performance will suffer due to memory constraints.
- Sometimes the matrix-style algorithm is inherently more difficult to express, requiring contorted matrix-style code to express something which is trivial to express as a simple for loop. We have many such examples in my line of work: Satellite images often have "nodata" or fill values, e.g., clouds are often masked out when you are interested in the land surface. We have had many examples where a Python+NumPy implementation required the explicit creation of a mask array to allow matrix operations to correctly ignore the nodata values. Once the masking operations become more involved, the Python code rapidly becomes less readable, thereby losing its main perceived advantage. Dealing with large images (often 20k x 20k pixels) requires massive mask arrays in NumPy, which places an unnecessary load on the OS to allocate and manage, and chews up usable memory bandwidth needlessly. Many of these examples were subsequently converted to C++, which not only produced much easier to read code (the mask operation reduced to a simple "if" statement inside a simple "for" loop), but yielded a worthwhile speed-up over the NumPy implementation, probably because of the decreased load on memory bandwidth.
I am using MATLAB mainly to prototype things and to develop an understanding. Thus, any way of expressing my ideas compact and readable using a small-ish set of instructions that I can re-use for decades is a good thing, even if it means increased execution time (up to a point).
- Conditional operations in a matrix-style language are inherently harder to express, similar to using SIMD operations. You typically have to calculate both branches of the conditional, and then use a mask to select the desired result. In many cases, this is not a problem, and many conditional operations can be accelerated nicely with SIMD. But not all of them. Looking at the assembler generated by g++, I have seen that simple conditionals often reduce to a conditional move (CMOV) instruction, which takes only about 5 clock cycles on modern processors (excluding the cost of the conditional test, which is only about 2 cycles, iirc). Since the conditional move instruction does not count as a jump, there does not appear to be any significant pipeline stalls and such. The implication of this is that even a very tight C++ loop can happily contain a conditional, which is contrary to what we had to do 20 years ago.
I am more of a C guy. But I have a feeling that if I had been born 20/40 years earlier, I would have been very happy with FORTRAN.
- I obviously like C++, and I would advocate the use of C++ even for prototyping when dealing with image processing problems.
Note that the mex interface is quite user-friendly, allowing you to call C/Fortran code directly. I find that when porting my stuff from MATLAB to C, doing one module at a time and calling it with the mex interface, keeping my MATLAB implemented tests and plotting luxury can be a real time saver.I use OpenCV extensively, which means that most typical image processing operations are reduced to a single method applied to an OpenCV matrix object, i.e., the code is in my opinion just as simple and readable as the corresponding MATLAB/Octave or Python/NumPy code. But you have the advantage of being able to use a simple nested loop to perform some operations over the entire image without incurring the massive penalty that such operations incur in the interpreted languages.
I am guessing that your context is that of a "high performance compute" engineer/scientist. I.e. one using Intels compiler, running on Intel hw? If that is the case, I think that you are correct, Intel themselves advocate against doing low-level coding. There are, however, other platforms and other compilers where auto-vectorization has not reached the same level of finesse.
- Modern C/C++ compilers are pretty good at spotting opportunities to automatically vectorize loops, meaning that what appears to be a simple for loop in the original code is actually compiled to a sequence of SIMD instructions. I am not an expert at writing inline SIMD code using the compiler intrinsics, but I have seen enough examples of where the compiler generated code is just as fast (or in some embarrassing cases, faster) than my explicit SIMD-ification of an algorithm, so I am slowly learning to trust the compiler to do the right thing.
I have managed to not have to care about threading algorithms. As long as the number of cores is small, and there are more than one thing to do, it seems a lot easier to put one job on each core.Alternatively, if the code is simple, and embarrassingly parallel, then there is always OpenMP, which will parallelize a for loop with the addition of a single line of code.
- With the advent of C++11, we now have many, many options to simplify the use of multi-threading. Once you have created a pool of threads (optionally with thread-local memory for storing results of operations that cannot be performed in-place), you can easily (well, easily if you copy a previously created example...) pass operations through a lambda function to be processed in parallel by the thread pool.
I think that your opinions are well adviced. Doubly so as you clearly have an understanding about what image processing should do, not only how to do it in software.Anyhow, these are just my opinions on this matter, and are not to be taken as prescriptions
-Frans
I think that the excellent IDE and plotting features is the main reason why I use MATLAB over Octave or Python, not the language/syntax/runtime itself.My view is that you should choose the most accessible tool first, then the fastest of what is available. For nonprogrammers, matlab/octave is often the most accessible. If matlab is faster, my view is that you should bite the bullet and pay the $100 or whatever for the personal license. If you are a diehard for FOSS, use octave even though it is slower. Last I saw, Octave's GUI is bordering on unusable (imo). Matlab's is better, and the code runs faster.
I guess that depends on:This particular anecdote serves my argument well: once you know what your solution should look like, it is time to move it to an efficient platform if you intend to use in a production set-up ( <cough> Imatest still running on Matlab ... )
Yeah, I knew I have been stirring up trouble with the Imatest/Matlab comment, but I'll add that I meant that tongue-in-cheek.I guess that depends on:This particular anecdote serves my argument well: once you know what your solution should look like, it is time to move it to an efficient platform if you intend to use in a production set-up ( <cough> Imatest still running on Matlab ... )
1. How sensitive are your users to efficiency
2. What is the added cost for re-implementing things more efficiently
I believe that the Nokia Symbian thing was really hw efficient. While certain modern cellphones run Java and similar high-level stuff. Not getting into a language war,
-F and -h,Yeah, I knew I have been stirring up trouble with the Imatest/Matlab comment, but I'll add that I meant that tongue-in-cheek.I guess that depends on:This particular anecdote serves my argument well: once you know what your solution should look like, it is time to move it to an efficient platform if you intend to use in a production set-up ( <cough> Imatest still running on Matlab ... )
1. How sensitive are your users to efficiency
2. What is the added cost for re-implementing things more efficiently
I believe that the Nokia Symbian thing was really hw efficient. While certain modern cellphones run Java and similar high-level stuff. Not getting into a language war,
Some days I just feel like I have earned the right to take the occasional pot-shot at Imatest
-F
When I was doing color science, my language of choice was Smalltalk. At IBM, that was fairly unusual. People would ask me, "Is it hard to learn Smalltalk?" I'd say, "No, I can teach you the entire language in an hour or two... but it will take you months to learn the class library."I think that what you are saying is a general thing: if you break your algorithm into a "pipeline" of small memory-to-memory operations, even if those operations are individually optimized to run as fast as physically possible on a piece of hardware, the performance will suffer due to memory constraints.
A "cure" for this would be to offer sufficiently diverse and complex library functions that most algorithms can just call the library directly. Unfortunately, this leads to an explosion in library complexity, and the programmer having to master a (usually) "unstructured" syntax.so as you clearly have an understanding about what image processing should do, not only how to do it in software.
One of the reasons that I started this thread was that I wanted to show that a very frequent operation in image processing where you run a window across an image for each pixel and then do some operation on that windowed data can be easily vectorized to give that windowed neighborhood of each pixel in a matrix array. And then you can perform corresponding operations on that array. That is where huge speeds up in both Matlab and Octave in hundreds followed up.-F and -h,Yeah, I knew I have been stirring up trouble with the Imatest/Matlab comment, but I'll add that I meant that tongue-in-cheek.I guess that depends on:This particular anecdote serves my argument well: once you know what your solution should look like, it is time to move it to an efficient platform if you intend to use in a production set-up ( <cough> Imatest still running on Matlab ... )
1. How sensitive are your users to efficiency
2. What is the added cost for re-implementing things more efficiently
I believe that the Nokia Symbian thing was really hw efficient. While certain modern cellphones run Java and similar high-level stuff. Not getting into a language war,
Some days I just feel like I have earned the right to take the occasional pot-shot at Imatest
-F
As you know I am a hobbyist and newly new to code (meaning that other than a little Fortran, Basic and Assembler almost, ahem, forty years ago I haven't done any).
I am really impressed at how easily I was able to pick up Matlab after Jim and Joofa's suggestion a couple of years ago*. Even more impressed at how quickly and easily I can find my numerous errors to make the code work. And even more impressed at the massive knowledge base available out there at the touch of a couple of keys. The IDE makes all the difference, Octave was too finicky for my non-expert fingers. Plus $85 for home use made Matlab irresistible for a prototyping amateur like me. Speed is good enough for my imaging purposes on my aging computers.
I can definitely see why many use Matlab for prototyping and if required move to the application-specific appropriate language for state-of-the-art speed.
Jack
*PS I tried Python but I did not find it as immediate, nor the knowledge base as extensive. With Matlab I was able to get useful stuff done the hour I turned it on.
An amazing Excel-site:It's very easy to write Excel code that runs, but produces wrong answers, and it's often difficult to find the bugs. Another problem is that I don't think that most Excel users think they are programming, and inadequately test their code.
Don't forget R, its fairly efficient for vector ops. The Microsoft R Open variant directly uses the Intel MLK so is somewhat better even. Also R Studio Server gives you a multi-user, access from anywhere platform for computing.I can still see some advantage of Matlab for some people. For me, personally, not many. In fact I get all the extra toolkits free for Octave the corresponding ones you have to pay for Matlab.
I have used R for machine learning work. It has a lot of statistical packages. That makes it worthwhile. RStudio is better now that they added debugging. And, I like that there is a remote debugging server for RStudio also. I found that very helpful in running an RStudio Server in AWS while connecting to that machine remotely via a laptop.Don't forget R, its fairly efficient for vector ops. The Microsoft R Open variant directly uses the Intel MLK so is somewhat better even. Also R Studio Server gives you a multi-user, access from anywhere platform for computing.I can still see some advantage of Matlab for some people. For me, personally, not many. In fact I get all the extra toolkits free for Octave the corresponding ones you have to pay for Matlab.