#bitfighter IRC Log

Index Search ←Prev date Next date→

IRC Log for 2012-04-08

Timestamps are in GMT/BST.

00:30:59raptorok back - sorry, i took my kid around the block on his two-wheeler
00:31:08raptortoo much network with Circle?
00:31:45raptorso for Core-mines, would they be instant kill? have a time-limit? Be destroyable?
00:32:30Watusimoto Quit (Ping timeout: 252 seconds)
00:42:02raptor Quit ()
00:45:41koda Quit (Quit: I used to be chatting like you. Then I took an arrow in the knee)
02:52:54Heyub Quit (Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/)
10:01:24sam686 Quit (Ping timeout: 245 seconds)
10:04:32koda has joined
12:03:49koda Quit (Quit: koda)
12:04:26koda has joined
12:11:30LordDVG has joined
13:18:29Watusimoto has joined
13:56:27raptor has joined
13:56:28ChanServ sets mode +o raptor
16:59:10sam686 has joined
16:59:11ChanServ sets mode +v sam686
17:27:08Watusimoto Quit (Ping timeout: 240 seconds)
18:01:02Watusimoto has joined
18:56:43Watusimoto Quit (Ping timeout: 246 seconds)
18:56:59Watusimoto has joined
19:01:27Watusimotohi
19:01:33Watusimotoquick syntax question
19:01:48Watusimotoin current scripts, we can load a file with require:
19:01:58Watusimotorequire("geometry") to load our geometry library
19:02:06Watusimotothat no longer will work
19:02:09Watusimotoso I
19:02:15Watusimoto'm creating a new function
19:02:37Watusimotothe function can either load the file but not execute it, so scripts would write this:
19:02:39Watusimotodofile(luaUtil:findFile("list"))
19:02:50Watusimotoor it can load and execute it, so we'd do this
19:03:02WatusimotoluaUtil:runFile("list")
19:03:35Watusimotothe only advantage to loading only is if...
19:03:45Watusimotooh heck, I'm not sure why you'd want to load only
19:04:20Watusimotoforget it
19:30:02raptorhi
19:30:10raptoruhh... i'll adapt?
19:48:40WatusimotoI can now run at least one bot
19:48:50Watusimotowhich is a huge step forward...
19:48:53Watusimotonow to try two
19:48:56raptorgreat!
19:49:49Watusimotowhen i can run multiple bots, I'll check in so you can measure the memory usage of each, and see if all this work has improved anything
19:50:45Watusimotook, two bots works!
19:50:48Watusimotoin the same L!
19:52:01Watusimoto5 bots work
19:52:09Watusimotook, checking in
19:53:52raptordid you check memory?
19:53:54raptoradd 100
19:55:28raptoror 50
20:00:36Watusimotohow woudl I check it? via process monitor?
20:00:45raptoryep
20:01:02raptorif it goes from 20MB -> 120 MB (with 100 bots_
20:01:14raptoror if it stays significantly less...
20:01:20raptorlet me test on my machine the RAM...
20:01:30Watusimotoah... freezes up a bit
20:02:19raptorok, no bots: 16/22 (dedicated/shared memory)
20:02:44Watusimotoperformance is NOT good
20:02:58raptorwith 100 bots: 61/22
20:03:14sam686it will help to run with non-debug compile with optimizations...
20:03:15Watusimototrying 017a with 100 bots
20:04:27raptorwith 50 bots: 41/22
20:04:37raptormaybe i should check virtual memory?
20:04:52raptorah, haha
20:04:53sam686while combining robots to one LUA might save memory, it doesn't really save any CPU usage - it still has to do a lot of calculations
20:05:01Watusimoto51748K "private bytes" to 97,000K with 100 bots
20:05:17Watusimotobots all died
20:05:28Watusimotoback to 55000K
20:05:42Watusimotoso that's the old way. I'll do a release build with the new way
20:05:58raptorgood idea
20:06:59WatusimotoThis new way cannot improve performance, only memory consumption. The best we can hope for is performance-neutral performance
20:07:10raptoryes
20:07:24raptorbut that is still good, esp. for dedicated servers on limited RAM hosts
20:07:26WatusimotoI can do some real optimizations during instantiation, though
20:07:44Watusimotowell, I'm more concerned with CPU than ram
20:07:56Watusimotobut i can compile all the standard bot support code once and clone it
20:08:01Watusimotowith the new ay
20:08:07sam686the smaller memory usage does help to prevent out of memory problems, mostly in some of limited RAM vps servers..
20:08:08Watusimotocurrently, we compile it for each bot
20:10:43raptorI remember adding zone-to-zone path caching to save CPU for each bot with 015a or 016...
20:11:02raptorwe could probably move that out to a more global scope to save RAM further
20:11:16raptormaybe i alreayd made it static...
20:12:05Watusimotocrashed
20:13:07LordDVG Quit (Remote host closed the connection)
20:13:54Watusimotook
20:14:01Watusimotofrom 49872K with no bots to...
20:14:26raptorthe suspense!
20:14:59Watusimoto70-75000K with 100 bots
20:15:08Watusimotodefinite improvement there
20:15:09raptorgreat!
20:15:14raptorthat's great!
20:15:19Watusimotobut the performance is total crap
20:15:27raptorworse than before?
20:15:37Watusimotomuch
20:15:40raptor100 bots is choppy even on my CPU
20:15:58Watusimotook, 73472K before (memory doesn't seem to be released, which is easily remedied)
20:17:21Watusimototo 85000K with 100 bots?
20:18:26Watusimotomemory jumps around a lot
20:18:38Watusimotowhich suggests lots of stuff being created, deleted, and garbage collected
20:22:46Watusimotomemory usage with old way is rock steady
20:23:10Watusimotoonce bot is created, I guess it just sits there in memory
20:24:18Watusimoto57->96->57,000K with 017a
20:24:23Watusimotoand 100 s_bots
20:24:46Watusimotoso new ay 25000K for 100 bots
20:24:49Watusimotoold way
20:25:00Watusimoto40000K for 100 bots
20:25:22raptorhmm...
20:25:27WatusimotoI would expect the memory use would be lower for new way
20:25:40raptorit is a significant change, but i guess i was thinking an order of magnitude...
20:25:53Watusimotoand I would not exect to see memory cycling like that
20:26:00Watusimotoneed to investigate a little further
20:26:16Watusimotobut perfornace of new way is, for the moment, unacceptable.
20:34:44raptori ownder if we should profile bot performance specifically
20:45:08Watusimotoprobably we should at some point
20:45:30Watusimotowe have some support for a lua profiler built in, though I've never used it
20:48:41WatusimotoI think I'm going to hold off on checking in until I feel better about where this is going
20:55:53raptoryou mean if it is even worth it?
20:56:44raptorI thought for sure that memory would be reduced to a tenth at least... but maybe my premise was wrong in the first place
20:59:52raptorFYI: i submitted the bitfighter 017a update to linuxgames.com and happypenguin.org... it should show up soon sometime
21:04:48Watusimotoexcellent. I sent an email a few days ago
21:04:59raptorto those same sites?
21:05:05raptoroh the list
21:05:07raptoryes
21:05:08raptorok
21:31:24Watusimotook, on madcow, adding 100 bots and watching the FPS gives comparable results from 017a and new lua method
21:31:31Watusimotowe need a better way of measuring!
21:33:06Watusimotothere really should be no performance penalty to the new way... I think it only does a pointer copy or two extra work
21:42:02raptorso you fixeds something?
21:51:31Watusimotono
21:51:35sam686dumb questing, are you making sure the "ontick" is called only once per robot? Make sure not to call onTick (100 robots) 10000 times..
21:51:38Watusimotojust hard to measure performance
21:52:00raptorok, so wait...
21:52:03Watusimotowhy would I call it 10k times?
21:52:09Watusimotodoes that happen now?
21:52:17raptorso now you say performance is similar or still worse?
21:52:31WatusimotoI can'
21:52:36WatusimotoI can't really tell
21:52:39sam686sending a onTick event 100 times, each event calls all 100 robot's onTick, thats a total of 10000
21:52:49Watusimotothat happens in 017a?
21:53:18sam686it happens earliear, maybe like between 016 and 015, but was fixed back then..
21:53:45Watusimotook, then it should still be fixed
21:53:50Watusimotothat would be a disaster
21:53:56Watusimotofor performance
21:53:59raptori remember that one
21:54:10raptoryeah, sam686's just double checking it's not happening again
21:54:38WatusimotoI hope not
21:54:49sam686if the RAM usage of bitfighter is jumping up and down a bunch of times, that can eat CPU usage trying to allocate and free memory..
21:55:26Watusimotoyes
21:55:35WatusimotoI can't figure out why it does that, thoguh
21:56:00Watusimotoshould be smooth as glass
21:56:22WatusimotoI/m not creating/deleting objects to manage the bots
21:57:38raptorseaglass?
21:59:40WatusimotoOn a 3 GHz P4 a lua_call() to an empty Lua function takes around
21:59:40Watusimoto80ns. A lua_pcall() (which is what you probably want) or a
21:59:40Watusimotolua_resume() takes around 130ns. Times are only slightly lower
21:59:40Watusimotowith LuaJIT because the overhead of calling _into_ the VM is
21:59:40Watusimotopretty much constant.
21:59:41WatusimotoSo you can make around 8 million calls per second into Lua (minus
21:59:43Watusimotothe time your app and the Lua functions take). Still worried?
22:01:32raptoris that copy pasta?
22:07:32Watusimotoyes
22:07:50Watusimotojust showing that there should be no problem with 100 bots
22:08:15raptorso our performance is due to our algorithms
22:08:26WatusimotoIt would seem so
22:08:47WatusimotoI'm testing some things just to make sure I'm not recompiing the script every cycle or something stupid like that
22:10:58Watusimotoit's statements like this that worry me (from s_bot:)
22:11:00Watusimotolocal bullets = bot:findItems(BulletType,AsteroidType,MineType)
22:11:16Watusimotothat creates a ton of objects when there are 100 bots shooting at one another
22:11:20raptoroh yikes
22:11:24Watusimotoyet... the bot needs this info
22:12:43sam686http://sam686.maxhushahn.com/upload/profile_4321_81b6c9c27092.PNG That is with 40 robots
22:13:28Watusimotogoing to try removing that line and see what it does to my performance
22:13:57raptorsam686: is all that allocation/free because of bullets?
22:14:06Watusimotoalloc
22:14:27Watusimotomaybe we need an object pool or something
22:14:43raptori would think that the gridDB calls should be comparatively the most expensive...
22:15:11Watusimotoyes -- perhaps those could be cached each game cycle
22:15:54sam686they are mostly coming from robots...
22:17:56raptorooo
22:17:57sam686bullets and all gameItems do not realloc, but vectors might realloc to make more room
22:18:51sam686but most of realloc's backtrace is mostly coming from "luaM_realloc_"
22:20:00raptorcool, gcc allows you to compile in profiling support..
22:20:37Watusimotobah, removing the line I pasted earlier makes no dramatic difference
22:25:10raptorbrb
22:25:12raptor Quit ()
22:26:11raptor has joined
22:26:12ChanServ sets mode +o raptor
22:26:55raptorhave good data:
22:27:14raptorhttp://sam686.maxhushahn.com/upload/profile_flat.txt
22:27:41raptorbut it's a lot...
22:27:50raptorhttp://sam686.maxhushahn.com/upload/profile_callgraph.txt
22:28:00raptorthe first is 1.2MB
22:28:08raptorthe second 6.8
22:28:31raptorthat's running the new ctf level with 20 bots for about a minute
22:36:39raptorthis is interesting, too: http://sam686.maxhushahn.com/upload/profile_annotated_robot_cpp.txt
22:36:45sam686i would still wonder why realloc appears to be the most costly on windows, more then linux....
22:38:54raptori can get annotated, profiled code for any class you want to see...
22:41:20raptormaybe Lunar is the problem?
22:42:55sam686C:\Program Files\Bitfighter\HG017\lua\lua-vec\src/lauxlib.c, l_alloc, lets see if i can change that function a bit, to use huge one megabyte array memory instead of lots of tiny memory, and my writing my own memory handling...
22:43:30raptorwell, before you do something drastic, maybe Watusimoto is already working on something?
22:47:08Watusimotono not really
22:47:11Watusimotojust poking around
22:47:18WatusimotoI got rid of some dynamic casts
22:48:15Watusimotobut I'm not quite convinced that lua is really creating tons of objects
22:48:33Watusimotoit's passing pointers to tons of objects, for sure
22:48:44Watusimotobut that might not create an allocation event
22:48:49Watusimotothose might be simple values
22:48:54Watusimotothat don't get allocated
22:49:15raptorwell, Lunar::thunk is sure being called a lot
22:50:22Watusimotothis one seems expensive:
22:50:23WatusimotocalcInterceptCourse
22:50:30Watusimotoand gets called a lot
22:51:47raptorhttp://www.rasterbar.com/products/luabind.html
22:52:03raptorseems to be the most oft cited way to bind lua to c++
22:52:08raptorluabind
22:52:10WatusimotoI think thunk is very cheap
22:52:16raptoris there a reason you chose Lunar?
22:52:17Watusimotoit's essentially a cast
22:52:21Watusimotoit was easy
22:53:47raptorthunk is cheap, but is called millions of times
22:55:13Watusimotoany binding system will need something similar, I think
22:56:43Watusimotothough maybe I'm wrong
22:56:47WatusimotoI don't know!
22:58:31WatusimotocanSeePoint gets called a ton too
23:00:31sam686thats a whole lot of l_alloc being called a lot, 76725 times in just 30 second of only 2 robots...
23:00:56sam686i put a printf in that function and found out
23:03:30Watusimotook, so what is calling that?
23:03:50WatusimotoI think it would be better to eliminate calls rather than try to optimize them
23:05:25raptoragreed
23:06:12sam686whats worse is a bunch of "l_alloc" is allocating a size of only 32 or 16 bytes..
23:08:01sam686lua/lua-vec/src/lauxlib.c have the l_alloc, jsut put a breakpoint there or printf or whatever, and see if you can fix too many l_alloc
23:08:52Watusimotoa gazillion tiny allocs can't be good
23:09:15raptorin LuaRobot::doFindItems there is a lua_createtable
23:09:24raptorthat method is being called the most, i think..
23:10:24sam686one of which is in LuaRobot::doFindItems .. lua_createtable .. luaH_new allocating 32 bytes... for every doFindItems...
23:10:52raptorouch
23:11:11Watusimotowe do that a ton
23:12:35Watusimotoah, we create a table to hold the items we found
23:12:55Watusimotoand probably discard it a moment later
23:14:25Watusimotowe could probably just push the found items onto the stack without a table
23:14:44Watusimotothe table is probably a real object create operation for lua
23:14:53raptorrobot.cpp:682 what is taht clearStack(L) doing?
23:15:07Watusimotothe other stuff might not be... might just be pushing values around
23:15:28Watusimotowill need context -- my numbers aren't same as yours
23:15:30raptorwhich is being called roughly 7 times per idle tick
23:15:34raptorper bot
23:16:02raptoroh, it's in doFindItems right before lua_createtable
23:16:10sam686really?? LuaShip::getCurrLoadout .. Lunar<Zap::LuaLoadout>::push .. <LuaRobot>pushuserdata.. lau_newuserdata .. realloc being called
23:16:22sam686as in any push creates alloc it seems...
23:16:47WatusimotoclearStack is just getting rid of any junk on the stack
23:17:03Watusimotowe won't need it when we have better stack hygine
23:17:13raptorhehe
23:17:22WatusimotoI've started adding asserts all over the place that ensure teh stack is cleaned when we're done with it
23:17:36Watusimotoso that's
23:17:37Watusimoto'free"
23:17:43Watusimotowe'd have to do that one way or another
23:18:36Watusimotoit's the create_table I'm suspicious of
23:19:25WatusimotoI'll try to rewrite without the table
23:19:29Watusimotosee if that helps
23:19:35Watusimotowill be messier, but perhaps faster
23:20:14WatusimotoI got rid of a dynamic cast in this fn, btw
23:20:20raptoryay
23:23:30sam686looks like my simplest mine_bot doesn't do any l_malloc, and eliza doesn't do any malloc except then outputting text
23:36:11WatusimotoI'm gong to add 100 elizabots and see what happens
23:39:37Watusimotoclose too 100 fps in debug mode
23:40:13Watusimotolet's try 500
23:40:30sam686i think the max robots limit is set to 256..
23:40:33Watusimotosending scoreboard crashed :-)
23:52:21raptorha! i just hit the map q-party on your server sam686
23:52:31raptori forgot how nutso this map was
23:58:24Watusimotobtw, we're using method 2
23:58:26Watusimotohttp://stackoverflow.com/questions/8003941/how-to-share-reuse-a-lua-script-for-multiple-entities

Index Search ←Prev date Next date→

These logs were automatically created by BFLogBot on irc.freenode.net.