( original link: https://github.com/DNS/benchmark-language )
I pruned and sorted the results to make it easier to read. And I added PureBasic to the results. I thought it would be better. Let me know if there is some way I can further optimize the PB version.
Here is the code I wrote for the PB version:
Code: Select all
EnableExplicit
Define x.d = 1
Define i.i = 0
OpenConsole()
Define StartTime.d = ElapsedMilliseconds()
For i = 0 To 99999998
x = (i+i+2*i+1-0.379)/(x)
Next
Define EndTime.d = (ElapsedMilliseconds() - StartTime) / 1000
PrintN("It took " + StrD(EndTime) + " seconds to complete.")
PrintN("Result: " + StrD(x))
PrintN("Press ENTER to exit. . .")
Input()
CloseConsole()
Code: Select all
local x = 1
for i=0,99999998 do
x = (i+i+2*i+1-0.379)/(x)
end
print(x)
Code: Select all
C (CLANG LLVM 6.0.0)
command took 0.65s
C (MSVC 18, VS 2013)
command took 0.65s
C (MINGW CLANG 8.0.1)
command took 0.65s
LuaJIT 2.0.5
command took 0.65s
C (CYGWIN CLANG 8.0.1)
command took 0.66s
C (GCC 7.2.0)
command took 0.66s
C (MINGW GCC 10.2.0)
command took 0.66s
C (CYGWIN GCC 10.2.0)
command took 0.66s
C# .NET CLR (CSC 12)
command took 0.67s
PureBasic 5.73 LTS 64-bit
command took 1.02s
(debug mode took 7.00s)
C (Embarcadero C++ 6.60 for Win32)
command took 1.40s
LUAC 5.3.4
command took 7.19s
LUA 5.3.4
command took 4.37s