--- Log opened Wed Jul 29 00:00:49 2009 |
00:21 | | You're now known as TheWatcher[T-2] |
00:24 | | * Derakon ponders his code. |
00:24 | | You're now known as TheWatcher[zZzZ] |
00:24 | <@Derakon> | So now that Vector2D is Cythonized, its .x and .y fields are always doubles. |
00:25 | <@Derakon> | This gives a nice speed boost, but makes it very annoying to use Vector2Ds in the context of the map grid, where I can only use ints to index into the grid. |
00:25 | <@Derakon> | And Python won't auto-cast them; it'll just throw a type error. |
00:25 | <@Derakon> | I'd really, really rather not have a whole bunch of int casts scattered throughout my code every time I deal with the grid. |
00:26 | <@Derakon> | I could deal with this via templating, if Python supported templating... |
00:27 | <@Derakon> | Any ideas? :\ |
00:29 | <@McMartin> | Can you have extra indexer methods that give ints? |
00:30 | <@Derakon> | Well, here's a standard check on the grid: |
00:30 | <@Derakon> | self.blocks[loc.x][loc.y] == BLOCK_EMPTY |
00:30 | <@McMartin> | Right. |
00:30 | <@Derakon> | I suppose I could make my own subclass off of list that overrides the [] operator. |
00:31 | <@Derakon> | Is that what you're suggesting? |
00:31 | <@McMartin> | I was thinking more [loc.ix][loc.iy] |
00:31 | <@Derakon> | Hmm... |
00:31 | <@Derakon> | Yeah, I could do that via properties. |
00:31 | <@Derakon> | Definitely better than anything else I've thought of so far. Thanks. |
00:56 | <@MyCatVerbs> | Derakon: why the blue Hell are you using doubles for indexing? |
00:56 | <@Derakon> | I'm not, intentionally. |
00:56 | <@Derakon> | Previously I'd relied on Python's auto-cast-to-int behavior, though. |
00:56 | <@MyCatVerbs> | Don't do that. |
00:56 | <@Derakon> | Or rather, I'd relied on the fact that the numbers in the Vector2D instances in question *were* ints. |
00:57 | | * MyCatVerbs <- static typing wonk. |
00:57 | <@MyCatVerbs> | Please don't do that. |
00:57 | <@McMartin> | He's using Python. Static typing is of the devil. |
00:57 | <@MyCatVerbs> | Auto-coercion is of two devils. |
00:58 | <@Derakon> | Apropos of nothing, a line of code I just encountered: |
00:58 | <@Derakon> | drawPoints.append(util.adjustLocForCenter(point.add(loc), camera, screen.get_rect()).tuple()) |
00:59 | <@MyCatVerbs> | Implicit coercion of numerical types is my pet reason for despising languages like PHP and C. |
00:59 | <@Derakon> | What's so bad about it? |
00:59 | <@MyCatVerbs> | Python's way of doing is is, IMHO, Exactly the Right Thing. It'll auto-widen, but never shorten without telling you. |
01:00 | <@McMartin> | OCaML requiring you to type 1+2, but 1.5 +. 3.4, is insanely obnoxious |
01:00 | <@MyCatVerbs> | Derakon: C's punched me in the face a few times in places where I've had everything silently promoted to ints, in expressions where what I actually needed was the specific overflow behavoir from using uint16_ts. |
01:00 | <@Derakon> | It seems to me that relying on overflow behavior is, itself, not such a hot idea. |
01:01 | <@MyCatVerbs> | e.g. uint16_t x = 65535; if (x + 1) { printf("%s","I wish this wasn't executed.\n"); } |
01:01 | <@MyCatVerbs> | Derakon: I dare you to write code that correctly handles wraparound without it. |
01:01 | <@Derakon> | ...oh, right, *that's* why the new Cythonized version ran so slowly. |
01:02 | <@Derakon> | I was comparing it against the version running on my desktop computer back in my apartment, which is much stronger than this laptop. |
01:02 | <@MyCatVerbs> | Especially netcode with sequence numbers packed into fixed-width fields. |
01:03 | <@MyCatVerbs> | McMartin: that's because OCaML is fugly as sin. Haskell lets you type both of those identically, thanks to typeclasses. Yay. |
01:03 | <@Derakon> | MCV: I'm just saying that if you're dealing with niche code, then you're going to run into edge cases in the language anyway. That doesn't seem like adequate cause to condemn a language feature as universally bad. |
01:03 | <@MyCatVerbs> | Derakon: I'm curious as to what, exactly, consitutes non niche code. |
01:04 | <@MyCatVerbs> | If a language offers fixed size fixed point integers, I would like operations on those to work in an unsurprising manner. |
01:06 | | Attilla [~The.Attil@92.20.11.ns-26724] has quit [Ping Timeout] |
01:12 | | Attilla [~The.Attil@92.23.118.ns-12659] has joined #code |
01:12 | | mode/#code [+o Attilla] by ChanServ |
01:25 | <@Derakon> | Hrmph. I'm getting different maps from the old version and the new version, despite the only changes being the new Vector2D class and a little refactoring that shouldn't have changed anything. This makes it hard to compare the speed of the old and new versions. |
01:29 | <@Derakon> | Ahh, interesting. http://derakon.dyndns.org/~chriswei/temp2/0.png is the old one. http://derakon.dyndns.org/~chriswei/temp2/1.png is the new one. |
01:40 | <@Derakon> | ...right, then. The removeIslands code, which is supposed to find small isolated chunks of terrain and turn them into nothingness, is instead *removing every wall in the map*. |
01:40 | <@Derakon> | Whups. |
01:48 | <@Derakon> | Aaand after all that, the Cythonized Vector2D class is 13s slower to generate the same map than the original code is. WTF. |
01:54 | | Attilla [~The.Attil@92.23.118.ns-12659] has quit [Ping Timeout] |
02:00 | | Attilla [~The.Attil@92.10.76.ns-3381] has joined #code |
02:00 | | mode/#code [+o Attilla] by ChanServ |
02:04 | <@Derakon> | Okay, looks like hashing is causing me problems. Adding 100k Vector2Ds to a set using old Vector2D class: 3.86s. With new class: 16.47s. |
02:05 | | Vornicus is now known as Phas |
02:09 | <@Derakon> | Actually, it's the comparison operator. |
02:09 | <@Derakon> | return (abs(self.x - alt.x) < constants.EPSILON and |
02:09 | <@Derakon> | abs(self.y - alt.y) < constants.EPSILON and |
02:09 | <@Derakon> | op == 2) |
02:10 | <@Derakon> | If I replace that with 'return True', I'm down to 1.93s. |
02:10 | <@Derakon> | If I do a (floating-point) comparison of the x and y fields, I get 8.17s. |
02:14 | <@Derakon> | Ah hah. New version, the set of 100k Vector2Ds (actually on the order of 400k) has only 1024 buckets. Old version, it has 101097. So it's my hashing function's fault after all. |
02:27 | <@Derakon> | Awesome, thanks MCV. :) |
02:28 | <@Derakon> | Went from 36s for that map to 13s. |
02:28 | | Attilla [~The.Attil@92.10.76.ns-3381] has quit [Quit: ] |
02:28 | <@Derakon> | And I'll keep that speed improvement so long as I don't try to make a dense map with values greater than ~1 million. |
02:29 | <@Derakon> | Which would be pretty dumbassed anyway. |
03:17 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?] |
04:01 | <@Derakon> | ...some interesting profiling output: |
04:01 | <@Derakon> | ncalls tottime percall cumtime percall filename:lineno(function) |
04:01 | <@Derakon> | 140206 1.090 0.000 2.216 0.000 warnings.py:24(warn) |
04:01 | <@Derakon> | 15189 0.798 0.000 5.470 0.000 map.py:1080(collidePolygon) |
04:01 | <@Derakon> | 70227 0.364 0.000 2.580 0.000 {range} |
04:02 | <@Derakon> | I have no idea what warnings.py is. |
04:02 | <@Derakon> | And I can't begin to understand how the cumtime and tottime values for range are so different. It's not a complicated function! |
04:04 | <@Derakon> | (In other news, performance is still terrible with multiple objects running around, even if mapgen is way faster) |
04:12 | <@Phas> | Der: range calls other functions. |
04:31 | | * Derakon mutters, tries to convert the Polygon class to Cython, runs into trouble because it depends on Vector2D, which isn't a trivial C type. |
04:31 | <@Derakon> | So apparently I need a definition file (similar to a C-style header file). I make one. The compiler complains it isn't there. Thank you, compiler. |
05:29 | <@Derakon> | ...wow, okay, that's ridiculous. |
05:30 | <@Derakon> | I went from ~4FPS to ~25FPS just by ensuring that the arguments I was passing to range were integers instead of floating points. |
05:30 | <@Derakon> | That's where all that warnings.py stuff was coming from. |
05:32 | <@Derakon> | My framerate is still not what I'd call great...but it's a damn sight better than it was before. |
05:33 | <@SmithKurosaki> | woot |
05:48 | <@Derakon> | Ahh, profilers. I'd be lost without you. |
06:02 | | Syloqs-AFH [~Syloq@ServicesAdmin.Nightstar.Net] has quit [Connection reset by peer] |
06:43 | | Derakon is now known as Derakon[AFK] |
06:52 | | Phas is now known as Vornicus |
07:18 | | AnnoDomini [AnnoDomini@Nightstar-29408.neoplus.adsl.tpnet.pl] has joined #Code |
07:18 | | mode/#code [+o AnnoDomini] by ChanServ |
08:04 | | Bobsentme [~Bob_sentm@Nightstar-14642.lightspeed.livnmi.sbcglobal.net] has quit [Connection reset by peer] |
08:15 | | Thaqui [~Thaqui@121.98.166.ns-22683] has joined #code |
08:15 | | mode/#code [+o Thaqui] by ChanServ |
09:04 | | Vornicus [Vornicus@Admin.Nightstar.Net] has quit [Quit: ] |
09:05 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has joined #code |
09:06 | | mode/#code [+o Vornicus] by ChanServ |
09:19 | | You're now known as TheWatcher |
09:57 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has quit [Operation timed out] |
10:03 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has joined #code |
10:13 | | Thaqui [~Thaqui@121.98.166.ns-22683] has quit [Quit: This computer has gone to sleep] |
10:15 | | Thaqui [~Thaqui@121.98.166.ns-22683] has joined #code |
10:15 | | mode/#code [+o Thaqui] by ChanServ |
10:35 | | Attilla [~The.Attil@92.10.76.ns-3381] has joined #code |
10:35 | | mode/#code [+o Attilla] by ChanServ |
11:13 | | Rhamphoryncus [~rhamph@Nightstar-7168.ed.shawcable.net] has quit [Quit: Rhamphoryncus] |
11:34 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code |
11:34 | | mode/#code [+o gnolam] by ChanServ |
11:44 | | * gnolam raises his eyebrow over the last MSVS 2005 patch. |
12:04 | | Thaqui [~Thaqui@121.98.166.ns-22683] has left #code [Leaving] |
13:09 | <@TheWatcher> | gnolam: hmm? |
15:06 | | GeekSoldier_ [~Rob@Nightstar-16991.sub-97-16-71.myvzw.com] has joined #code |
15:07 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has quit [Ping Timeout] |
15:09 | | GeekSoldier_ [~Rob@Nightstar-16991.sub-97-16-71.myvzw.com] has quit [Ping Timeout] |
15:12 | | GeekSoldier_ [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code |
16:01 | <@gnolam> | http://www.microsoft.com/technet/security/bulletin/MS09-035.mspx |
16:06 | | Syloqs_AFH [Syloq@Admin.Nightstar.Net] has joined #code |
16:07 | | Syloqs_AFH is now known as Syloqs-AFH |
16:51 | | Derakon[AFK] is now known as Derakon |
16:53 | | Consul [~Consul__@Nightstar-2425.dsl.sfldmi.ameritech.net] has quit [Quit: Leaving] |
17:08 | | Consul [~Consul__@Nightstar-2425.dsl.sfldmi.ameritech.net] has joined #code |
17:08 | | mode/#code [+o Consul] by ChanServ |
17:36 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Quit: Leaving] |
17:38 | | Vornicus [Vornicus@Admin.Nightstar.Net] has joined #code |
17:38 | | mode/#code [+o Vornicus] by ChanServ |
17:40 | | Vornicus [Vornicus@Admin.Nightstar.Net] has quit [Quit: ] |
17:42 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has joined #code |
17:42 | | mode/#code [+o Vornicus] by ChanServ |
17:49 | | GeekSoldier_ [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has quit [Quit: Praise "BOB"!] |
18:32 | | * Derakon doubles the number of active objects, watches performance plummet again. |
18:33 | <@Derakon> | I'm spending half my time in Map.collidePolygon or its callees. |
18:35 | <@Vornicus> | How much stuff is going on in collidePolygon? |
18:36 | <@Vornicus> | It seems like most of thetime you should be able to bail out pretty damn early. |
18:36 | <@Vornicus> | Or, you know - not call it at all. I thought you were using quadtrees. |
18:36 | <@Derakon> | Quadtrees for dynamic objects, yes. |
18:36 | <@Derakon> | But the map grid is ideally suited for, y'know, a *grid*. |
18:37 | <@Derakon> | Just find which blocks the dynamic object's bounding box intersects. |
18:37 | <@Derakon> | Here's Map.collidePolygon(): http://paste.ubuntu.com/236057/ |
18:38 | <@Derakon> | Profiler says that out of 6.509s in this function and its callees, 1.876s were spent in it. |
18:42 | <@Vornicus> | Hokay. That's a lot of crap in there... hm. |
18:55 | | TarinakyKai [~Tarinaky@Nightstar-16638.plus.com] has joined #code |
18:56 | | * Derakon splits the function into two, determines that the code that fixes ejection vectors is taking a relatively minor amount of time. |
18:57 | | Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout] |
19:05 | <@Vornicus> | I note that you don't do any hard coding for uninteresting collidable edges. You may be able to improve your situation there. |
19:05 | <@Derakon> | Uninteresting collidable edges? |
19:09 | <@Vornicus> | In the sense of N: an uninteresting collidable edge is a grid edge that is entirely solid. |
19:12 | <@Vornicus> | You can do them a lot faster because you already know whether it's intersecting that edge or not. |
19:15 | <@Derakon> | So you're saying e.g. if the player runs horizontally into a block, then I don't need to check other blocks that are immediately above/below that block? |
19:15 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Patch] |
19:15 | <@Vornicus> | That sort of thing, yes. |
19:21 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code |
19:21 | | mode/#code [+o gnolam] by ChanServ |
19:24 | | Tarinaky_ [~Tarinaky@Nightstar-16638.plus.com] has joined #code |
19:24 | <@Derakon> | Okay, that improved things a bit... |
19:24 | <@Derakon> | FPS += 1, from 4 to 5. |
19:26 | <@Derakon> | I don't suppose you have any ideas for this function? http://paste.ubuntu.com/236069/ |
19:26 | | TarinakyKai [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout] |
19:26 | <@Derakon> | It's taking about .8s of the 12s runtime. |
19:38 | | Rhamphoryncus [~rhamph@Nightstar-7168.ed.shawcable.net] has joined #code |
19:40 | <@Derakon> | Hey, Rhamphoryncus. |
19:41 | < Rhamphoryncus> | heya |
19:41 | <@Derakon> | I got my Vector2D class ported to Cython, and it sped things up remarkably. |
19:41 | < Rhamphoryncus> | cool |
20:04 | <@Derakon> | I can't keep up with #python... |
20:04 | <@Derakon> | 786 members is too many. |
20:12 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has quit [Operation timed out] |
20:16 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has joined #code |
21:15 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code |
21:15 | | mode/#code [+o GeekSoldier] by ChanServ |
21:45 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has quit [Connection reset by peer] |
22:06 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code |
22:06 | | mode/#code [+o GeekSoldier] by ChanServ |
22:06 | | crem_ [~moo@Nightstar-28703.adsl.mgts.by] has joined #code |
22:07 | | crem [~moo@Nightstar-28703.adsl.mgts.by] has quit [Connection reset by peer] |
22:57 | <@McMartin> | Oog. |
22:57 | | * McMartin goes to troubleshoot a problem that turns out to actually be in Preview.app's PS-to-PDF conversion. |
23:00 | <@Derakon> | Oh, fun. |
23:23 | | AnnoDomini [AnnoDomini@Nightstar-29408.neoplus.adsl.tpnet.pl] has quit [Quit: When the end is near, pants on the west rune, and step on the east.] |
23:28 | | Netsplit DeepThought.NY.US.Nightstar.Net <-> Blargh.CA.US.Nightstar.Net quits: Tarinaky_, @GeekSoldier, Kazriko |
23:37 | | Tarinaky_ [~Tarinaky@Nightstar-16638.plus.com] has joined #code |
23:37 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has joined #code |
23:37 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code |
23:37 | | mode/#code [+o GeekSoldier] by ChanServ |
23:39 | | * gnolam arghls at wchars. |
23:39 | <@McMartin> | UTF-8, motherleegers, do you speak it |
23:39 | <@McMartin> | (Answer: No, never.) |
23:40 | <@gnolam> | No. Nothing ever does. :P |
23:40 | <@McMartin> | UTF-8 and UCS-4 are the only sensible choices. :colbert: |
23:40 | <@McMartin> | And on Windows, wchar_t isn't UCS-4. |
23:40 | <@McMartin> | Though it is admittedly Generally Good Enough. |
23:45 | <@McMartin> | Actually, on Java "wchar_t" isn't UCS-4 either, but since Java *does* speak UTF-8, albeit haltingly, that's also Generally Good Enough. |
23:46 | <@gnolam> | Unfortunately, source only speaks UCS-2, little endian. And it's a pain in the ass. |
23:46 | <@gnolam> | *Source |
23:46 | <@McMartin> | Yeah, that's the Windows wchar_t. =( |
23:46 | <@McMartin> | Hah, what happens if you cast it to LPWSTR? |
23:47 | <@McMartin> | If it's *exactly* what Win32 uses, you might be able to sleaze it out |
23:48 | <@gnolam> | I'm sorry Dave. I'm afraid I can't do that. |
23:50 | <@gnolam> | Ye gods. |
23:51 | <@gnolam> | Manipulating C strings is hard to do cleanly on the best of days, but this... |
23:51 | <@gnolam> | I'm afraid the villagers will come after me with torches and pitchforks for what I've just written. |
23:52 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has quit [Ping Timeout] |
23:52 | | Tarinaky_ [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout] |
23:52 | | Tarinaky_ [~Tarinaky@Nightstar-16638.plus.com] has joined #code |
23:52 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has quit [Ping Timeout] |
23:55 | | Kazriko [~kazrikna@Nightstar-26123.gdj-co.client.bresnan.net] has joined #code |
23:55 | <@McMartin> | Heh |
23:56 | <@McMartin> | Having an actual string class is one of the few unambiguous reasons to choose C++ over C. |
23:56 | | GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code |
23:56 | | mode/#code [+o GeekSoldier] by ChanServ |
--- Log closed Thu Jul 30 00:00:03 2009 |