I'm using a fairly standard MSI mobo with Intel Core i5-6400 processor and 64 GB RAM.
So: Which programming language (besides assembly) is the most effective to use in this configuration when I want to do calculations/modelling trying to find the least number of combinations to fullfill some predefined conditions.

More specific I have i.e. 5 sets of combinations each containing three different states: A, B and C.
This gives me a total number of 243 combinations.
Theoretically it is possible to reduce this number of combinations to 23 so that no matter what combination of the original 243 you choose you'll always have 4 out of 5 of them correct.

If you have 4 sets of combinations the theoretically minimum of combinations fullfilling this requirement is 9 (and those 9 combinations are available today).

So I want to know what programming language should I use ?
(I'm able to put all the combinations in memory to speed up the process).

Recommended Answers

All 19 Replies

If you only have 243 combinations to process then you could program it in anything and it would still take a millisecond
For performance to be an issue you need to be processing billions of combinations (assuming there's no I/O or database access needed).
In any case, any modern compiled language is just as likely to be as fast as any other, varying from one case to the next.

So use the language you know, or the one that expresses the algorithm in the clearest code.

@JamesCherrill points out that what is more important this time round is you creating something that a) you can write and b) you understand.

I've seen such efforts done in Excel because it's a on-off and they needed to show both the data and how they arrived at their answer. Even in Excel you are looking at 1/10 of a second times or less.

C Language is used to be considered as most powerful programming language.

Where you get such info?

C Language is used to be considered as most powerful programming language.

... which is why everyone uses it for any kind of application all the time. No, wait a minute, that can't be right....

In terms of the capabilities and features of the language itself raw C is, of course, just about the least "powerful" language ever. "Simplest and fastest" maybe, provided that you are talking about writing device drivers.

The most computer-intensive example would be 12 set of combinations with 3 different states: A, B and C.
That would be 531 441 different combinations, and if I want to reduce this amount of combinations still fullfilling the requirement of 11 out of 12 correct it would thoretically be 21 258 combinations. And to find them would be a bit of a challenge to my computer. Then it'll matter which language to choose... :-)

@it. This reminds me of an old app I wrote long ago which was in Visual C# 2008 that was on a Core2Duo laptop. Why that language? It was what I was working in on other apps at the time so for me it was easy to implement in what I was currently using every day.

Your question hides another question which is something like "Do I use what I know or stike out on a new adventure?" To that my answer is if you have the time. I gave a nod to Excel because these one-off problems can sometimes be done there and we are done. We don't worry that it took the computer a second to do the work because, done.

-> As to the language my answer is that it doesn't matter. Heresy you say? My view is the algorithm beats language choice every time. You could choose the fastest language but have a poor algorithm and be beat by an Excel spreadsheet.

That would be 531 441 different combinations,

... on a machine that can do a BILLION if tests in a second. Do the sums.
Unless there's some aspect of this that you're not sharing you do not have a perfomance problem and trying to select a language based on the speed of of its compiled code is irrelevant. Even so there's a ton of benchmark data that shows all the major compiled languages having very similar perfomance averaged across a range of realistic tests. Chose one that expresses the algorithm in the clearest code.

commented: That's also my experience. Maybe, long ago there was more of a difference but today, not so much. +15

In biology DNA has units called Codons. Each codon consists of three tiny molecular structures called base pairs, each of which can have one of four possible values, so a codon can have any of 64 possible values. Think of a group of sequential computer files with codons being like bytes. Since there are roughly three billion base pairs in our DNA, if one is doing DNA computer analysis iy would probably be a good idea to think about how to do it most efficiently.

Agreed. There are computing problems for which you want to carefully pick:

  1. The most efficient algorithm
  2. The most optimized programming language
  3. The fastest hardware/OS platform

But to worry about the above for the OP's problem is a complete waste of time.

For 243 combinations it is utterly undue considering the language implications.
Of course, if you intend to perform the validation 1 billion times over 243 combinations the matter would be different.

For all intents and purposes I would select C for speed, VB or VB.NET for ease or direct validation against a database already running on C such as MySQL.

When using C and VB (classic or -NET) you can relay the processing to the client machine.
For this even Java is sufficient as I cannot se any advanced algorithm causing undue delays.

In the case of MySQL or another database you're not seldomly bound to a server depending on the client waiting in place and locking some processing time of the server.

In the end, it is the logic in your algorithm that determines speed and outcome.

I often process statistics such as 20 options over 70 numbers where a sub set are valid.
Prevalidating by incorporating if-statements in C seems counterproductive but increases speed of processing the rules for my own algorithm by a magnitude of 6 or more.
That is, some 1 000 000 times faster than leaving the if-statements out of the algorithm.

Better coding for a specific purpose takes time. But only once.

Hi Friends
It's difficult to be a product designer nowadays without utilizing Java Script.

HI Friends
According to me Java Script is most effective programming language.

Better start with assembly, then some php or python to see their advantages

commented: Learning to drive? Start with a formula 1 racing car so you'll appreciate a Datsun -3

Python all the way, it's been simplified so instructions are clear, easily understandable and it's a really powerful language in high demand currently.

If you want to be a front end programmer then go with JavaScrip and want to work as backend developer then PHP is the best. Otherwise, if you want to go with more advance options then go with Python. I am also conducting a course of machine learning in Python and have future plans to learn R. However, it is better to try free courses at first from Coursia or Udemy to understand which is easy for you.

You can write most things in most languages and have it perform either horribly or quite good enough.

And often people have a completely incorrect idea about performance.

I've just completed a project in Java for a customer who was insistent that Java would never be able to offer the required performance (they needed it to handle messages in under 80 milliseconds per batch of several hundred messages).
We delivered an application that didn't just match their requirements, but blew them out of the water.

We could have however just as easily written something that was so glacially slow it'd still be processing the first message 2 weeks after the test began. It all depends on proper application architecture, design, and implementation.

Problem is, if you're asking the question you are asking you're in no position to design such a system let alone implement it.

Python is one of the most commonly used programming languages today and this is an easy language for beginners to learn because of its readability. Python is used to develop 2D and 3D animation packages, and to create video games etc.,

C or C++, and thats because those two languages are very good platform for all aspiring coders, btw here's a very good article, What Is Coding? do check it out too. Thanks

You are using a fairly good CPU and a very easy algorithm to solve using coding. The answer is that you can use any language of your choice.
All programming lanaguges are fairly good these days.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.