Physics experiment: simulation of moving electrons, hydrogen and boron ions in a magnetic field

Computer simulation of idea 10

Experiment 10

 

Trying to make the program faster:

My main computer is: Intel (R) Core i3-4130T CPU @ 2,90 GHz  2,90 GHz  Ram 4,00 GB  Sistema operativo de 64 bits, procesador x64, Windows 10 Home.

With this small  console application (see Wikipedia console_application) it took 53 seconds to run the  loops.
The program itself has a size of 16 kB.
Program Test (source code)

When the program is started it waits for a key to be pressed and uses then about 0 % of the CPU and 0,1 % of the memory. Running it takes about 25,6 % if the CPU and 0,1 % of the memory.

The same program but in the "visual object" environment of Delphi 4 has a size of 301 kb (19 x bigger).
To run through the same loops took 42 sec. Not a lot of difference.
Program Test2 (source code)

Running it takes also about 25,6 % if the CPU and 0,1 % of the memory.

Running the simulation program also takes about 25,6 % of the CPU and 0,1 % of the memory, and it hardly makes any difference when the simulation is pauzed or running. (by the way, when the simulation starts it shows up a welcome screen and uses still only 0 % of the CPU).

-

2e computer: Intel (R) Core due CPU E8500 @ 3,16 GHz 3,17 GHz Ram 3053 MB  32 bits Windows Vista
Test running on this computer: 50 % CPU 440 Kb memoria. It took 33 seconds to run the loops.
Test2 running on this computer: 50 % CPU 1256 Kb memoria. It took 35 seconds to run the  loops.

Simulation program running on the 2e computer: 50 % CPU 272 Kb memoria.

Running the simulation program on both computers -> more or less the same,  the speed on the main computer is about 5 % higher than on the 2e computer (but not very precisely measured).

-

3e computer: eMachine E520  Intel Cpu  575@ 2,00 Ghz 2,00 Ghz,  4,00 Gb
Test running:  49 % Cpu 424 Kb memoria  ,  1 min 20 sec to run through the loops

Running the simulation program on the main and the 3e computer -> the speed on the main computer is about 1,6 times higher than on the other computer

-

4e computer: Advent Intel N270 @ 1,60 GHz  1,60 Ghz 1,99 GB Ram Windows Xp.
Test running:  47 % Cpu 1868 Kb memoria  ,  4 min 20 sec to run through the loops

Running the simulation program on the main and the 3e computer -> the speed on the main computer is about 2 times higher than on the 4e computer.

Compiling the test program in the programming language Lazarus (15 MB) and running the loops took also about 40 seconds on the main computer. Running the loops in the most simple Pascal program(69 KB)  in Lazarus took about 55 seconds on the main computer.

Running the loop:
var x, y: real;
for i:= 1 to 100000
do
for j:=1 to 100000 do
begin
x:=i;
y:=j;
end;

goes about two times faster.

I managed to compile the simulation program in Lazarus... At the moment I will continue in Delphi 4, because used to it. If necessary can change it to Lazarus, which is multi-platform.

Conclusion so far:
The faster the computer, the faster the simulation program.
The object oriented visual programming language Delphi seems not to slow down the calculation of loops, and so the simulation program.
A loop can be made more efficient/faster (see for example www.aivosto.com ).
En case the simmulation can be easily switched to the programming language Lazarus.

 

 

 

 

Facebook

 

First idea (Jan. 2013)
Second idea (Jan. 2013)
Third idea (Jan. 2013)
Fourth idea (3 Febr. 2013)
Fifth idea (6 Febr. 2013)
Sixth idea (8 Febr. 2013)
Seventh idea (16 Jan. 2014)
Eighth idea (17 Jan. 2014)
Ninth idea (20 Jan. 2014)

 

Tenth idea (2014 - 2016)
Computersimulation 10e idea  ((2015-2016)
 

 

 

2016     by  Rinze Joustra        www.valgetal.com