code logs -> 2013 -> Sat, 20 Apr 2013< code.20130419.log - code.20130421.log >
--- Log opened Sat Apr 20 00:00:21 2013
00:01 El_nino [Torres@3818FF.9EAFAA.E3A621.6EAF94] has joined #code
00:01 El_nino [Torres@3818FF.9EAFAA.E3A621.6EAF94] has quit [[NS] Quit: ]
00:45 mac [mac@Nightstar-fe8a1f12.il.comcast.net] has quit [[NS] Quit: Leaving]
00:55 Turaiel is now known as Turaiel[Offline]
01:03 thalass_ [thalass@Nightstar-f97b970e.bigpond.net.au] has joined #code
02:07 Turaiel[Offline] is now known as Turaiel
02:18
<&McMartin>
Whoa
02:18
<&McMartin>
BinHex was originally a TRS-80 technology o_O
02:18
<@celticminstrel>
:O
02:30 Derakon is now known as Derakon[AFK]
02:34
<@froztbyte>
wat
02:34
<@froztbyte>
well, that kinda makes sense, actually
02:34
<@froztbyte>
"woo endianness", etc
02:58 Turaiel is now known as Turaiel[Offline]
03:02 iospace [Alexandria@Nightstar-e67f9d08.com] has quit [Ping timeout: 121 seconds]
03:03 iospace [Alexandria@Nightstar-e67f9d08.com] has joined #code
03:03 mode/#code [+o iospace] by ChanServ
03:10 Turaiel[Offline] is now known as Turaiel
03:17 thalass_ is now known as Thalass|afk
03:51 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
03:51 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
03:51 mode/#code [+o celticminstrel] by ChanServ
03:57 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:10 Turaiel is now known as Turaiel[Offline]
04:13 Turaiel[Offline] is now known as Turaiel
04:13 Kindamoody[zZz] is now known as Kindamoody
06:08 Thalass|afk is now known as Thalass|netbook
06:23 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:49 syksleep is now known as Syk
06:49 Thalass|netbook [thalass@Nightstar-f97b970e.bigpond.net.au] has quit [Operation timed out]
06:59 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
07:18 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
07:20 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
07:20 mode/#code [+ao Derakon Derakon] by ChanServ
07:22 Derakon[AFK] [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
07:31 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
07:31 ErikMesoy|sleep is now known as ErikMesoy
07:32 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
07:32 mode/#code [+o himi] by ChanServ
07:32 ErikMesoy [Erik@Nightstar-cede6fb6.80-203-23.nextgentel.com] has quit [[NS] Quit: Reboot.]
07:43 ErikMesoy [Erik@A08927.B4421D.403BAA.818DC8] has joined #code
07:50 Turaiel is now known as Turaiel[Offline]
07:57 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
07:57 mode/#code [+ao Derakon Derakon] by ChanServ
08:05 Derakon is now known as Derakon[AFK]
08:32 AnnoDomini [abudhabi@Nightstar-c2e7115f.adsl.inetia.pl] has quit [Ping timeout: 121 seconds]
08:39
<&McMartin>
Hee hee
08:39 * McMartin mounts the strangest of defenses of JavaScript
08:40
<&McMartin>
("The problem isn't JS's implementation of closures; that, as you can see, tracks Scheme's implementation of them. The problem is that JavaScript has mutable state and uses it for loops.")
08:45
<&McMartin>
(Scheme has aliasing issues if you bind a variable in multiple closures and then set! values referenced thereby. However, named let and call-with-cthulhu-invocation do not have this problem.)
08:53 * Alek munches some popcorn, watches on.
08:55
<&McMartin>
That's about it, really.
08:55
<&McMartin>
This is a mistake, in JS: for (i = 0; i < 10; ++i) { a[i] = function() { return i+1; }; }
08:55
<&McMartin>
Because you will find that all the functions in a return 11, because they're all referring to the same "i".
08:56
<&McMartin>
If you do the same construct in Scheme (with set! for mutation) the same thing happens, so clearly the fault is with having mutable state, not closures~
08:56
<&McMartin>
(If you instead use tail recursion or continuation-based loops in Scheme, this does not happen because it's a new environment each time, so the problem is less likely to occur "accidentally".)
09:09
<@Azash>
McMartin: So when you create the function, it won't resolve "i+1" immediately but rather store the reference?
09:16
<&jerith>
Azash: Yes.
09:16
<&jerith>
The whole point of the closure is that the code in it only gets executed when you call it.
09:17
<&jerith>
The closure contains a reference to the external variable "i", which can be modified outside the closure.
09:19
<&jerith>
You can probably work around it by putting "local_i = i" (or whatever JS uses to create a variable in the local scope -- I don't actually know the language) and using local_i instead.
09:21
<&McMartin>
Actually you generally do it by wrapping it in another closure~
09:21
<&McMartin>
a[i] = (function(x) { return function() { return x + 1; }; })(i);
09:24
<&jerith>
McMartin: I think that's "whatever JS uses to create a variable in the local scope".~
09:24
<&jerith>
(Or, more accurately, it creates a local scope in which you can have a a local variable.)
10:12 Kindamoody is now known as Kindamoody|out
10:46 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
10:59 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
10:59 mode/#code [+o himi] by ChanServ
11:07 abudhabi [abudhabi@Nightstar-f3c6459d.adsl.inetia.pl] has joined #code
11:08 abudhabi is now known as AnnoDomini
12:05 EvilDarkLord [jjlehto3@Nightstar-2ebc32b2.cs.hut.fi] has joined #code
12:05 mode/#code [+o EvilDarkLord] by ChanServ
12:36 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
13:37 Syk_ [the@A6D346.0419D1.F98395.ADFE65] has joined #code
13:40 Syk [the@Nightstar-60339bc0.iinet.net.au] has quit [Ping timeout: 121 seconds]
13:47 Kindamoody|out [Kindamoody@Nightstar-e9aa495d.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
13:53 Kindamoody|out [Kindamoody@Nightstar-05577424.tbcn.telia.com] has joined #code
13:53 mode/#code [+o Kindamoody|out] by ChanServ
14:12
<@gnolam>
"Funny story, my first day, at my first ever games job, was at Mindscape. And I heard one of my chiptunes coming from the Production office. They'd just downloaded Moonstone (which was a Mindscape game) from a BBS..... could have been my shortest ever first job ;)"
14:28 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
14:28 mode/#code [+o celticminstrel] by ChanServ
14:28 ^Xires is now known as Xires
14:31 Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has quit [Ping timeout: 121 seconds]
15:18 Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has joined #code
15:19 mode/#code [+o Orthia] by ChanServ
16:02 RichyB [richardb@Nightstar-86656b6c.cable.virginmedia.com] has joined #code
16:16 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
16:16 celticminstrel is now known as celmin|away
16:28 Turaiel[Offline] is now known as Turaiel
16:29 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
16:29 mode/#code [+o himi] by ChanServ
16:35 Turaiel is now known as Turaiel[Offline]
18:09 Syk_ is now known as syksleep
18:47 Derakon[AFK] is now known as Derakon
18:56 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
18:56 mode/#code [+qo Vornicus Vornicus] by ChanServ
19:39 Kindamoody|out is now known as Kindamoody
20:34 Chutzpah [Moltare@583787.FF2A18.190FE2.4D81A1] has quit [Ping timeout: 121 seconds]
20:38 Kindamoody is now known as Kindamoody[zZz]
21:13 * Derakon eyes Python.
21:13
<&Derakon>
I have a loop that does "for xi, yi in [(x - 1, y - 1), (x, y - 1), ...]"
21:14
<&Derakon>
I replaced it with "for dx, dy in [(-1, -1), (0, -1), ...]: xi = x + dx; yi = y + dy" and went from 2.6s to 2.45s in runtime.
21:14
<&Derakon>
WTF.
21:16 Chutzpah [Moltare@583787.FF2A18.190FE2.4D81A1] has joined #code
21:17
<@froztbyte>
haha
21:17
<@froztbyte>
how many elements?
21:17
<&Derakon>
8.
21:17
<@froztbyte>
ah, not many
21:17 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
21:18
<@froztbyte>
yeah I only just did the permutation now
21:18
<&Derakon>
It's iterating over the neighboring cells to a given cell.
21:18
<@froztbyte>
weird though
21:19
<@froztbyte>
I don't know the innards well enough to tell you why :/
21:26 Turaiel[Offline] is now known as Turaiel
21:29 * Derakon whips up a quick demo script. http://pastebin.com/r44rKdLx
21:31
<&Derakon>
Whoops, there's a spare 'y' in bar(); removing that makes it even faster! http://pastebin.com/n6sEEZQ6
21:45
<&Derakon>
And fully-unrolling the loop makes it almost twice as fast: http://pastebin.com/v5g3qK5S
21:46
<@Tamber>
funroll! \o/
21:46
<&Derakon>
Unfortunately I don't know how I'd go about applying that to the heatmap code.
22:05 Demonchyld [demonchyld@Nightstar-5f9c789b.ri.cox.net] has joined #code
22:05 Demonchyld [demonchyld@Nightstar-5f9c789b.ri.cox.net] has left #code []
22:37
<@[R]>
http://i.imgur.com/tFdoSWq.jpg
22:43 ErikMesoy is now known as ErikMesoy|sleep
22:54
<@froztbyte>
.....wow
22:56 Turaiel is now known as Turaiel[Offline]
22:56
< AnnoDomini>
What the shit.
22:57
<&McMartin>
PAIN IS YOUR FRIEND
23:11 * RichyB giggles.
23:21
< AnnoDomini>
Indeed. There is a genetic condition that makes you unable to feel pain. Typically, these children die very early.
23:22
<&Derakon>
Oh hey, RichyB, any ideas on the optimization problem I was dealing with earlier?
23:23
<&Derakon>
Ultimately I'm trying to make this function faster: http://pastebin.com/PVYrhTxm
23:32
<@EvilDarkLord>
Derakon: If you want to optimize on that level, then some comparisons on 50-51 are unnecessary depending on dx and dy. For example, coordinates resulting from positive dx/dy never have to be checked for being at least 0.
23:32
<&Derakon>
Isn't checking if dx >= 0 equivalent in cost to checking if neighbor[0] >= 0?
23:33
<&Derakon>
I mean, I guess I could have separate loops, but then there'd be an awful lot of duplicated code -- everything except the conditionals.
23:33
<@EvilDarkLord>
Yes, that's what I mean. But I wouldn't go there, because it makes it look awful.
23:35
<@EvilDarkLord>
(Rather just rewrite as a C module if you need extra speed that much)
23:35
<&Derakon>
I'd really rather not do that because of the extra compiler step. :(
23:35
<&Derakon>
Cython at least can automatically compile at runtime.
23:37
<@EvilDarkLord>
What interpreter are you using?
23:37
< RichyB>
Derakon: I made an attempt at throwing the heat-map algorithm into C earlier but didn't get anywhere with it.
23:38
<&Derakon>
I note that fully-unrolling that dx/dy loop takes runtime from 2.394s to 1.713s in my speed test.
23:38
< RichyB>
Not sure whether the way in which I was trying to go about sharing buffers between C and Python is actually legal.
23:38
<&Derakon>
(With massive code duplication)
23:38
< RichyB>
EvilDarkLord: CPython, but I didn't see more than a 3x speedup at best with PyPy, and that only on certain sizes.
23:38
<@EvilDarkLord>
Derakon: Clearly you should have your cake and eat it too and dynamically generate the code and then call the interpreter on it. :P
23:39
<&Derakon>
Ugh!
23:39
<&Derakon>
Don't even joke about that.
23:39
<&Derakon>
I've dealt with code like that. >.<
23:39
< RichyB>
EvilDarkLord: Chameleon uses exactly that for HTML templating.
23:39
<&Derakon>
Mind, Cython might have a macro system I could use.
23:42
<&Derakon>
Oh wait, that speed gain was from optimizing the conditional tests.
23:42
<&Derakon>
As EDL suggested.
23:44
<@EvilDarkLord>
I'm assuming that almost all the time goes into lines 42+, is that correct?
23:44
<&Derakon>
Yeah.
23:44
<&Derakon>
Typically there's only one goal node.
23:45
<&Derakon>
But even in a moderately-constrained dungeon there can be thousands of iterations of the "while cellQueue" loop.
23:57 * RichyB facepalm.
23:57
<@EvilDarkLord>
Derakon: Have you tried popping -1 instead of 0?
23:57
< RichyB>
I have a lot of off-by-one errors.
23:57
<@EvilDarkLord>
On line 43.
23:57
<&Derakon>
EDL: you mean, off the end of the list? Then it wouldn't be a breadth-first search.
23:57
<@EvilDarkLord>
Oh, derp
23:58
<@EvilDarkLord>
I just experimented and found that popping with -1 from a list of 100,000 entries deletes the list about 72 times faster than popping with 0.
23:59
<&Derakon>
Heh.
23:59
<&Derakon>
Yeah, because Python has to periodically move the list around in memory if you keep removing the head, IIRC.
23:59
<&Derakon>
Or something like that.
--- Log closed Sun Apr 21 00:00:35 2013
code logs -> 2013 -> Sat, 20 Apr 2013< code.20130419.log - code.20130421.log >

[ Latest log file ]