code logs -> 2010 -> Fri, 23 Jul 2010< code.20100722.log - code.20100724.log >
--- Log opened Fri Jul 23 00:00:17 2010
00:01 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
00:10 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
00:17 You're now known as TheWatcher[T-2]
00:21 You're now known as TheWatcher[zZzZ]
00:35
< celticminstrel>
Which qualifiers are we talking about now?
00:40
<@Vornicus>
"inline", among others.
00:41
<@Vornicus>
"register", that pile.
00:51
<@McMartin>
"static", on the other hand, is mandatory~
00:54
< Tarinaky>
What're we talking about?
00:56
<@ToxicFrog>
C+
00:56
<@ToxicFrog>
C++, rather
00:56
<@ToxicFrog>
Don't do it too much or you'll go blind~
00:57
< Tarinaky>
Too late.
00:57
< Tarinaky>
Most the uses of static you could -probably- fake with namespaces and globals :/
00:58
< Tarinaky>
Although I suspect that's not what was being discussed.
00:58
<@McMartin>
"mandatory" means "the compiler isn't allowed to ignore it".
00:59
<@McMartin>
"inline" and "register" are hints and the compiler can override the programmer at will while remaining compliant.
00:59
< Tarinaky>
Ah. That.
01:00
< Tarinaky>
Isn't there also the requirement for an inline function to still be allocated memory as a function even if it's no longer actually called?
01:03 Attilla [Obsolete@Nightstar-303ce1dd.threembb.co.uk] has quit [[NS] Quit: ]
01:07 AnnoDomini [annodomini@Nightstar-ba4df6b6.adsl.tpnet.pl] has quit [[NS] Quit: leaving]
01:08
<@Vornicus>
Dunno, but with block-scoping I suspect you can actually allocate additional stack memory partway through any function without calling more functions.
01:08
<@Vornicus>
...actually, uh
01:09
<@Vornicus>
an inline function may just end up telling its parent how much memory it needs in the compile step, if all the memory is grabbed up at call time.
01:12
< Tarinaky>
Vornicus: I was of the understanding that inline functions had to be allocated because of function pointers?
01:13
< Tarinaky>
I seem to recall under specific situations (I think if they're inside a class maybe?) they can't be optimised away.
01:14
< celticminstrel>
The register keyword is being repurposed in C++1x, as I recall.
01:14
< celticminstrel>
But I don't remember as what.
01:15
< Tarinaky>
celticminstrel: I think it's being made more abstract to refer to any speed optimisation.
01:17
< celticminstrel>
It might be just changed to mean "local variable", a function previously taken by "auto".
01:39
<@Vornicus>
Hokay. Given four points of known distance to each other (in 3 space) I can, given distances from those four points to any other, locate that point in 3 space. The question is, how.
01:50
<@Vornicus>
(three points gives you two possibilities.)
01:57
< celticminstrel>
This reminds me of Stargate, for some reason...
02:11 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Client closed the connection]
02:11 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
02:13 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
02:18
<@Vornicus>
HOkay. Given distances between three points I can place all three on a plane; the fourth, then, gets placed via intersection of three spheres, and I just pick the positive z value.
02:47 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
03:40 PinkFreud [WhyNot@Pinkfreud.is.really.fuckin.lame.nightstar.net] has quit [Ping timeout: 121 seconds]
03:43 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
03:50 * Vornicus hands someone convenient the "NO SHORTCUTS" stick.
04:02 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code
04:08 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
04:23 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
04:29 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
05:24
<@Vornicus>
I have hatred for linalg!
05:40 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
06:11 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:17 cpux is now known as shade_of_cpux
08:16 AnnoDomini [annodomini@Nightstar-ce54b4b1.adsl.tpnet.pl] has joined #code
08:16 mode/#code [+o AnnoDomini] by Reiver
09:08 You're now known as TheWatcher
10:04 Vornicus is now known as Vornicus-Latens
10:46 aoanla [AndChat@37647E.0002A6.6F1B60.CA0BCB] has joined #code
10:46 aoanla [AndChat@37647E.0002A6.6F1B60.CA0BCB] has quit [[NS] Quit: ]
11:47 * TheWatcher args at emacs, wonders why its syntax highlighting has suddenly gone and messed up
11:49 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
12:32 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited]
12:40 shade_of_cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [[NS] Quit: ChatZilla 0.9.86 [Firefox 3.6.7/20100713130626]]
13:33
< Tarinaky>
Right. -now- I can start worrying about making 650 operations~ (Re: Something someone said... I think it was either VOrn or TF)
13:35
<@ToxicFrog>
It was Vorn, and you were worried about the performance hit of using the Mersenne Twister despite not having done any sort of analysis or experimentation.
13:35
<@ToxicFrog>
Performance is nothing until you can prove you don't have it.
13:36
<@TheWatcher>
Make it work, then make it work better, then make it work faster~
13:45
< Tarinaky>
I wasn't worried.
13:45
< Tarinaky>
I'm currently at the stage where it works 'better'.
13:46
< Tarinaky>
But it's noticably slow.
13:46
< Tarinaky>
So I wanted to know. How do you analyse a program to work out what bits to optimise?
13:46
< Tarinaky>
Aside from just guessing from the documentation.
13:49
<@ToxicFrog>
Your two main weapons are algorithmic analysis and profiling.
13:50
< Tarinaky>
My current 'guess' is I need to cut down the number of SDL blits I perform.
13:50
<@ToxicFrog>
A profiler is a program you run your program inside that, afterwards, tells you how the time broke down - which functions did it call, how long did it spend in them, etc.
13:50
<@ToxicFrog>
This lets you identify where your bottlenecks are.
13:51
<@ToxicFrog>
Once you know that, you can figure out how to optimize them - maybe you're using an O(n^2) algorithm where you could be using O(nlogn). Maybe you're making lots of small IO operations when you could be making a few big ones. Maybe this function here was just written without an eye to efficiency and needs to be tightened up because it turns out to be called a lot more than expected. Maybe your design is inherently inefficient and needs
13:51
<@ToxicFrog>
to be rethought.
13:51
<@ToxicFrog>
But it starts with profiling.
13:52
< Tarinaky>
Right. What'd I use to profile a python script?
13:52
<@TheWatcher>
http://docs.python.org/library/profile.html ~
13:58
< Tarinaky>
1882460 function calls (1882218 primitive calls) in 21.552 CPU seconds \o/
14:03 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
14:04
< Tarinaky>
I'm not really... sure how I'm meant to use these statistics :/
14:08
< Tarinaky>
I -think- it's telling me that I'm spending a lot of time in python2.6/random.py
14:09
< Tarinaky>
It certainly has a lot of calls.
14:09 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
14:12
<@TheWatcher>
Yes, but that's probably what you'd expect - how much time per call, compared to other functions you are calling, does it take?
14:13
< Tarinaky>
More than it takes to perform an SDL blit by the looks of this.
14:15
< Tarinaky>
http://tarinaky.pastebin.com/Hf3H5NB6
14:15
< Tarinaky>
Oh wait. No.
14:15
< Tarinaky>
I can't read.
14:15
< Tarinaky>
Yeah. SDL blit's up the list higher.
14:17
< Tarinaky>
So from this it's telling me i need to cut down on the number of sdl blits I perform, yes?
14:18
<@ToxicFrog>
Looks like it.
14:18
<@ToxicFrog>
200k blits for ~250 frames seems a bit excessive.
14:21
< Tarinaky>
Three layers of about 30 tiles. Every frame's made from 'scratch' without reusing anything from the previous frame. So yeah... pretty excessive.
14:57 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
15:07
< Tarinaky>
Also, what is a 'CPU second'?
15:25
<@ToxicFrog>
A second of CPU time.
15:25
<@ToxicFrog>
That is to say, a second spent actually executing your code on the chip, which may be longer than a second realtime (if on a multitasking system) or shorter (if it's a threaded program on a multicore system)
15:28
<@ToxicFrog>
Also - three layers of ~30 tiles each? That's around 100 blits/frame. You're pushing 800.
15:30
<@ToxicFrog>
I suspect a lot of this is starfield generation; your program spent 80% of its execution time in or under starfield/get_frame
15:37
< Tarinaky>
Yes.
15:38
< Tarinaky>
Well. My plan is to make the buffers bigger than the screen by about a row and a column in all directions.
15:38
< Tarinaky>
Then actually scroll it (blitting in the new rows/columns when the buffer reaches the top.
15:40
< Tarinaky>
That way it's only performing 3 blits per frame for -most- frames.
15:40
< Tarinaky>
And fewer than it is now every few frames.
15:49
< gnolam>
http://www.lysator.liu.se/~gnolam/temp/intensimeter_28_WIP_5.png
15:49
< gnolam>
http://www.lysator.liu.se/~gnolam/temp/intensimeter_28_WIP_6.png
15:50 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
15:51
< Tarinaky>
gnolam: Wassat?
15:54
< gnolam>
Intensimeter 28/T. Slightly modified AN/UDR-13 pocket radiac.
15:54
< gnolam>
This little feller: http://www.canberra.com/products/1130.asp
16:00
<@ToxicFrog>
Tarinaky: are you regenerating the starfield slices every frame right now?
16:05
< Tarinaky>
I'm regenerating everything every frame right now.
16:10
<@ToxicFrog>
Aah.
16:11
<@ToxicFrog>
Yeah, one quick and easy optimization you can do here is generate a starfield slice only the first time it's seen, and save it.
16:12 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
16:13
< Tarinaky>
Well. I was thinking holding onto a larger buffer and only generating a row at a time would probably be faster and not involve growing memory.
16:13
< Tarinaky>
Since you're only going to be generating the same starfield slices if you're going back and forth.
16:14
< Tarinaky>
Which is a bit of an arbitrary criteria.
16:24
<@ToxicFrog>
"holding on to a larger buffer"?
16:29
< Tarinaky>
<Tarinaky> Well. My plan is to make the buffers bigger than the screen by about a row and a column in all directions.
16:29
< Tarinaky>
<Tarinaky> Then actually scroll it (blitting in the new rows/columns when the buffer reaches the top.
16:29
< Tarinaky>
Emphasis on the holding onto.
16:30
< Tarinaky>
That way it doesn't touch the starfield module at all except when it needs to :/
16:35
< Tarinaky>
Anyway. Might as well do it now.
16:42
<@ToxicFrog>
Rows and columns? I thought this only scrolled on one axis?
16:42
< Tarinaky>
Oh no. I have it 2D atm :/
16:42
< Tarinaky>
The maths is the same and it doesn't really make it any more complicated to do 2D.
17:05 Attilla [Obsolete@Nightstar-ad930fff.threembb.co.uk] has joined #code
17:05 mode/#code [+o Attilla] by Reiver
17:33 aoanla [AndChat@37647E.0002A6.6F1B60.CA0BCB] has joined #code
17:37 jeroid [jerith@687AAB.5E3E50.627C4E.9E55C7] has joined #code
17:50 Attilla [Obsolete@Nightstar-ad930fff.threembb.co.uk] has quit [[NS] Quit: ]
17:59 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
18:32 aoanla [AndChat@37647E.0002A6.6F1B60.CA0BCB] has quit [[NS] Quit: ]
19:01 Vornicus-Latens is now known as VOrnicus
19:01 VOrnicus is now known as Vornicus
19:03 McMartin is now known as McMartin[Ohio]
19:09 You're now known as TheWatcher[afk]
19:13 jeroid [jerith@687AAB.5E3E50.627C4E.9E55C7] has quit [[NS] Quit: Bye]
19:32 aoanla [AndChat@Nightstar-2c9ea6d0.range81-129.btcentralplus.com] has joined #code
19:38 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
19:39 Syloqs_AFH is now known as Syloqs-AFH
20:11 TarinakyKai [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
20:15 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Ping timeout: 121 seconds]
21:46 You're now known as TheWatcher
21:54 Zed_ [Zed@Nightstar-e4835f03.or.comcast.net] has quit [Connection reset by peer]
21:54 Zed_ [Zed@Nightstar-e4835f03.or.comcast.net] has joined #code
22:15 aoanla [AndChat@Nightstar-2c9ea6d0.range81-129.btcentralplus.com] has quit [[NS] Quit: ]
23:23
< TarinakyKai>
Anyone about?
23:26 * simon_ abouts
23:36
< TarinakyKai>
Currently musing about a problem I had several months ago with C++.
23:37
< TarinakyKai>
Specifically, how to make pointers as painless as possible.
23:40 TarinakyKai [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Connection closed]
23:56 AnnoDomini [annodomini@Nightstar-ce54b4b1.adsl.tpnet.pl] has quit [[NS] Quit: SLEEP CYCLE, REBOOT.]
--- Log closed Sat Jul 24 00:00:18 2010
code logs -> 2010 -> Fri, 23 Jul 2010< code.20100722.log - code.20100724.log >