Programming Loops

a simple programming project

 

Full Write Up

This is my full write up. It's a bit long, so be ready for some reading.
This write up is the original writeup for the project. This was writen nearly six months, and some of it may be out dated. Also, this dosen't cover the second set of loops. (If you're looking for just a quick overview of the project, try this.

 
 

Which programming language can run a set of loops faster?
What programming language is fastest?

I think C++ will be able to run a set of loops fastest and be the fastest as well because of it?s low-level power, and because it's very close to already being in binary.

1. Decide a number of programming languages you will use.

2. If one of the chosen programming languages cannot use "loops," you will need to choose another.

3. When you know all of your programming languages can use "loops," you may start to write the programs.

4. This is a standard template that the programs can be based upon. (Note: You can see this example after this list; formatting issues.)

5. After you have made your programs you will start to run them. You should be a number for the programs to count up too. You must use this number for every program.

6. You can run the programs, do about 12 runs for each program. You may spread the 12 runs over multiple computers for a better average.

7. When the program you are currently running is done on all of the computers you ran on, record them. Take down the milliseconds and the name, and put them on/in an excel document (if you have it, otherwise a table on a piece of paper.)

8. Repeat 6 and 7 for each program.

9. When you are done with all of the programs, add together all of the times to find the average time. Record this time. Do this for program.

10. Repeat 9 for each program.

11. You are more or less done, if you used computers that are not owned by you, you might want to uninstall the programs you added to them.

[start]
Input "Number to count to?", loopnumber
Variable Time1
Start loop > loopnumber
Display Number
Number = Number + 1
End Loop
Variable Time2
Display (Time2 - Time1)
[end]
Code Example

You can view my data by following this link. The reason for having an external page is that it is better viewed at a size larger then the current page's width and it will be much clearer. Sheet 1 is the complete data chart, with all the averages and data from each run. Sheet 2 is the compact version where only the averages were stored.

You can view my graphs by following this link. The reason for having an external page is that it is better viewed at a size larger then the current page's width and it will be much clearer. There are two data graphs, the first, being a graph of all the programming languages. The second is a graph of only the top five.

The Conclusion follows, there are two versions, the one in this page, and an external one for better viewing.

Section One: Looking at the data gathered by the experiment, it was found that Visual Basic.net was the fastest programming language, at 2569.666667 milliseconds. BASIC was the slowest language, although the explanation for this is the intensive graphical display, at 559162.6667 milliseconds. JavaScript was a very unstable language to test, because it is run in a browser, and if a loop is taking an extended amount of time, the browser will attempt to break the loop and save the browser from crashing. ASP.net + VB.net was also interesting in the outcome, that it took it longer, while being a much more complex language than PHP, was actually even slower then JavaScript. The second fastest language was J#.net, which is followed by C#.net. Both languages are extremely similar. At, 2604.25 and 2702.5 milliseconds respectively, they are no more then 100 milliseconds apart. This is probably because of the great similarity between them. Once more, PHP and python are also similar, at 3841 and 13002.38364 milliseconds respectively, was a large difference compared to what was prior to it. That difference may be attributed to the difference in running requirements. PHP is only executed on the server, on the web, and the python that was tested, was only able to run on a computer that had python libraries installed. While J#.net was the second fastest, its counter part was also the second slowest, Windows Form J#.net, at 182586.8333 milliseconds. That being said, J#.net was said to be able to run Windows Form types as well as command line, so this result may be false, and a glitch.

Section Two: The hypothesis claimed that C++ would be the fastest because of low level support. C++ does have low-level support and abilities, but this would not directly affect the result of running loops. Looping requires one variable to hold a number that is changed every 10000th of a second. That does not require memory location access, hardware access, or any thing of the sort. C++ was the fourth fastest however, which is fast. Although not the fastest, there may be more that C+ can do faster than the languages that are faster then it. This is because C++ has high and low level support and capabilities.

Section Three: The Windows Form J#.net was a surprising result because on the Microsoft Website, it claims it's extremely fast, with an example of a calculator made in J#.net. This may be because looping is not a very complex task, but calculating formulae may be. The case may be that J#.net is better at doing complex tasks, which are not necessarily repetitive. The Visual Basic.net program was also surprising. While people commonly assume Visual Basic.net is slow, in this project, it was the fastest. Visual Basic is commonly called slow because people use much more complex commands than looping, adding from 0 to 50000. Visual Basic has a hard time handling graphics from what was documented on various sites, which could be what people refer too. In this test, graphical handling was not taken into account in speed, but had it, it may have been closer to where it?s counter part is, Windows Form Visual Basic.net.

Section Four There are many places of error. The fist being inside of the programs them selves- being written in multiple languages, coming close to a perfect translation from and to each is difficult. Visual Basic.net doesn't require you to explicitly change number variables into string variables. Each type needs a specifically amount of memory reserved for what it will hold, Visual Basic.net does this automatically for you, while in C#.net and in C++ and most of the others, it does require you do it yourself, and not for you, automatically. The second place for error is in how they were run- there was not enough runs for a definite answer as it seems now. Twelve runs seem too small, while 25 may have been better. Twelve was used because of time restraints. 25 would have also taken many more hours of waiting, because the slower languages are very time consuming while running, since they can take nearly three to nine minutes each. The third place of error on the platforms that were used to run the programs- while some were run on home-end computers, others on the server(online), which may have caused discrepancies. The last error noted was what was being done while the programs were being run- the computers were being used too. This could account for the slowness of supposedly fast languages. An example of this is having media player open while have the Windows Form J#.net program open. That could cause problems such as new memory placement, slower graphical update response times, and things that are not noticed while not running a loop or a very close time oriented event.

Section Five The errors must all be corrected or controlled to a degree in which the experiment may be done with out being able to correct the results without the aid of the program's record. In other words, the errors will be allowed if the user recording the recording of the program can correct them in their recording if the program cannot do it's self. After finishing the testing, running, and writing of the general experiment, another improvement was added. The programs were originally based on a counting loop template, where it starts at zero and counts by one to a set number, in the tests, 50000. While this is fine for most testing, this failed to take into account the graphical handling, mathematical handling, function, and things such as input output speeds. Because of this, doing tests such as, drawing a figure, whether a line or shape, doing a semi-complex algebra problem in rapid succession, toggling functions and keeping track of global and in and under level variables and writing to and reading from different types of files and as well as loop counting, would make this project, albeit much larger, much better in terms of which language is truly the fastest. The fact that all these languages may not be able to do all of these things makes performing these experiments much more difficult.

Section Six In conclusion, Visual Basic.net can run a set of loops the fastest among 12 different programming languages.