• My benchmark script says "Linux is suck"
    6 replies, posted
I created simple physics benchmark tool and tested on my PC using windows and linux. I am shocked because my benchmark shows that linux is much worser than windows. Script is very inaccurate but anyway difference of results is too big. Please help me explain that. What the script is doing: creates one bath and spawns cans to it. Before it spawn new can, it checks fps (using RealTime) and if it is low (< 50), then spawn is delayed. Result is sum of delays during spawn of 60 cans. Lower is better. My result: Windows has no problem to reach 60 cans. Time is less than 10s, often lower than 1s (0.x). Linux stucks on about 50 cans. The result would be at least 10 minutes (i didnt want wait more). On windows tested both in game and srcds, result are very similar. On Linux - srcds. Tested at least 3 times. I run commands (UPDATE: map gm_flatgrass, spawns in the middle): sv_hibernate_think 1 lua_openscript canbenchmark.lua Here script: [URL="http://student.agh.edu.pl/~arbuzixx/duperele/canbenchmark.lua"]http://student.agh.edu.pl/~arbuzixx/duperele/canbenchmark.lua[/URL] I put this thread here because there is a high probabiliy that Linux is fine and my script is suck. UPDATE: tested on Haswell 4.2 GHz, Windows 7 SP1 x64, Ubuntu 16.04 x64
I'm not sure why exactly, but gmod definitely takes much longer to load on Linux than it does on Windows. This is not anything to do with the OS, since both kernels are quite similar in performance these days. Although one OS is slightly faster at some things and slightly slower at others, they're not much different at all. It must be down to the way the platform-specific parts are being done, I think.
[QUOTE=arbuzixx;50430804]I created simple physics benchmark tool and tested on my PC using windows and linux. I am shocked because my benchmark shows that linux is much worser than windows. Script is very inaccurate but anyway difference of results is too big. Please help me explain that. What the script is doing: creates one bath and spawns cans to it. Before it spawn new can, it checks fps (using RealTime) and if it is low (< 50), then spawn is delayed. Result is sum of delays during spawn of 60 cans. Lower is better. My result: Windows has no problem to reach 60 cans. Time is less than 10s, often lower than 1s (0.x). Linux stucks on about 50 cans. The result would be at least 10 minutes (i didnt want wait more). On windows tested both in game and srcds, result are very similar. On Linux - srcds. Tested at least 3 times. I run commands (UPDATE: map gm_flatgrass, spawns in the middle): sv_hibernate_think 1 lua_openscript canbenchmark.lua Here script: [URL="http://student.agh.edu.pl/~arbuzixx/duperele/canbenchmark.lua"]http://student.agh.edu.pl/~arbuzixx/duperele/canbenchmark.lua[/URL] I put this thread here because there is a high probabiliy that Linux is fine and my script is suck. UPDATE: tested on Haswell 4.2 GHz, Windows 7 SP1 x64, Ubuntu 16.04 x64[/QUOTE] As far as linux ive never used ubuntu, ive always used CentOS and Debian. Try those possibly better results?
I am a linux user on my laptop. Which is as old as my grandma, and as thick as my front yard's pavement stone. I used a lot of linux systems on that laptop. Stil, with Arch x64 bit. And latest Xorg software and drivers. I am getting around 50fps static. When I use windows on that laptop. I can't get higher than 12fps. I haven't noticed any slow loading. But that's probably due the SSD is has.
Your code is bad. Try this; [lua] local function Benchmarkgmod() local BenchStart = RealTime() for i=1,1000,1 do local e = ents.Create( "prop_physics" ) e:SetModel( "models/props_junk/PopCan01a.mdl" ) e:SetPos( Vector(0,0,-12250) ) e:Spawn() e:Activate() e:GetPhysicsObject():EnableMotion( false ) e:Remove() end local BenchFinish = RealTime() print( "Benchmark Results: " .. tostring( BenchFinish - BenchStart ) .. " seconds to spawn,freeze,remove 1000 props" ) end timer.Simple(1, Benchmarkgmod ) [/lua] Expect this to freeze your game for a bit.
[QUOTE=ph:lxyz;50431679]I'm not sure why exactly, but gmod definitely takes much longer to load on Linux than it does on Windows. This is not anything to do with the OS, since both kernels are quite similar in performance these days. Although one OS is slightly faster at some things and slightly slower at others, they're not much different at all. It must be down to the way the platform-specific parts are being done, I think.[/QUOTE] My words in first post didn't reflect my thoughts (sorry). When i write 'Linux' i think about Garrysmod linux srcds server runned on Linux. When i write 'Windows' i think about Garrysmod windows srcds server (eventually game) runned on Windows. I don't want discuss which system is better. I want discuss which version of Garrysmod srcds server works faster/better: Linux version or Windows version. These versions are likely to differ. If my script is right, then this may mean that physics engines are pretty different on Windows srcds and Linux srcds. I wonder maybe on Windows is faster, but less accurate than on Linux? [QUOTE=Pyro-Fire;50438593]Your code is bad. Try this; [lua] local function Benchmarkgmod() local BenchStart = RealTime() for i=1,1000,1 do local e = ents.Create( "prop_physics" ) e:SetModel( "models/props_junk/PopCan01a.mdl" ) e:SetPos( Vector(0,0,-12250) ) e:Spawn() e:Activate() e:GetPhysicsObject():EnableMotion( false ) e:Remove() end local BenchFinish = RealTime() print( "Benchmark Results: " .. tostring( BenchFinish - BenchStart ) .. " seconds to spawn,freeze,remove 1000 props" ) end timer.Simple(1, Benchmarkgmod ) [/lua] Expect this to freeze your game for a bit.[/QUOTE] I think you didn't understand idea of my script. It benchmarks physics (cans bounces).
gmod physics benchmark; [lua] local TestTime = 60 -- Realtime in seconds local function Benchmarkgmodphysics() local TestStart = RealTime() local TestEnd = TestStart+TestTime local props = {} local frames = 0 -- Counter hook.Add("Tick","GmodPhysicsBenchmark",function() if( RealTime()>TestEnd ) then hook.Remove( "Tick", "GmodPhysicsBenchmark" ) for k,v in next,props do v:Remove() end print( "Benchmark Results: " .. frames .. " frames calculated in " .. (RealTime()-TestStart) .. " seconds" ) else frames=frames+1 end end ) for i=1,100,1 do local e = ents.Create( "prop_physics" ) e:SetPos( Vector() ) e:SetModel( "models/props_phx/construct/metal_wire1x1x1.mdl" ) e:Spawn() e:Activate() table.insert( props, e ) end end timer.Simple( 1, Benchmarkgmodphysics ) [/lua] This will spawn a perpetual physics collision with lots of entities which should give more accurate results for your purposes. (and possibly crash your server given the model used. if that happens use less entities)
Sorry, you need to Log In to post a reply to this thread.