00:29:22  * c4milojoined
00:36:59  * c4miloquit (Remote host closed the connection)
00:37:25  * c4milojoined
00:41:01  * c4milo_joined
00:42:19  * c4miloquit (Ping timeout: 272 seconds)
00:44:03  * c4milo_quit (Remote host closed the connection)
00:44:31  * c4milojoined
00:49:26  * c4miloquit (Ping timeout: 264 seconds)
01:01:10  * carifquit (Quit: Ex-Chat)
01:31:30  * abraxasjoined
01:40:57  * carifjoined
01:52:15  * iamdustanjoined
02:05:51  <isaacbw>can I reasonably expect V8 to be using 32 bit signed integers until I go over 2^31?
03:00:11  * c4milojoined
03:18:48  * jaseemabidjoined
03:28:53  * jaseemabidquit (Ping timeout: 272 seconds)
03:42:27  * carifquit (Ping timeout: 260 seconds)
03:56:21  * carifjoined
04:03:29  * carifquit (Quit: Ex-Chat)
04:32:34  * c4miloquit (Read error: Connection reset by peer)
04:33:38  * c4milojoined
05:00:28  * jaseemabidjoined
05:19:11  * c4miloquit (Remote host closed the connection)
06:16:20  * spolujoined
06:56:40  * bnoordhuisjoined
07:32:24  * muellijoined
07:38:27  * mralephquit (Read error: Connection reset by peer)
07:38:29  * mraleph1joined
07:44:40  * spoluquit (Ping timeout: 260 seconds)
07:59:10  * spolujoined
08:08:58  * Lethalmanjoined
08:11:23  * juanjosanchezjoined
08:12:41  <guor>isaacbw, for +/- 2^30, yes
08:13:23  <guor>we use 31-bit integers in most cases
08:13:34  <guor>optimized code also uses 32-bit integers internally
08:41:52  * jaseemabidquit (Read error: Operation timed out)
08:44:07  <muelli>hm... So an "Internalized" string is a string that has been added to the internal cache, correct? As opposed to a "normal" string, which is not added to the internal hashmap...
09:01:26  * bnoordhuisquit (Ping timeout: 264 seconds)
09:11:33  * bnoordhuisjoined
09:12:40  <bnoordhuis>muelli: correct
09:22:52  <muelli>cool
09:30:26  <muelli>Corollary: One can only make use of the cached string one creating "new" internalized strings, i.e. factory()->InternalizeTwoByteString() as opposed to factory()->NewStringFromTwoByte(). Correct?
09:32:33  * abraxas_joined
09:34:27  <bnoordhuis>muelli: correct
09:38:34  * abraxasquit (Read error: Connection reset by peer)
09:53:14  * jaseemabidjoined
10:02:03  * Petkajoined
11:01:23  * abraxas_quit (Remote host closed the connection)
11:01:55  * abraxasjoined
11:06:08  * abraxasquit (Ping timeout: 240 seconds)
11:16:20  * iamdustanquit (Ping timeout: 265 seconds)
11:42:01  <muelli>Can I make v8 internalize strings from JavaScript land?
11:49:55  <bnoordhuis>muelli: i don't think there's a builtin for that. you'd probably have to add one in src/runtime.{h,cc}
11:50:20  <bnoordhuis>one question comes to mind though: why? :)
11:50:43  <muelli>bnoordhuis: only to craft test cases in JavaScript.
11:51:14  <muelli>could have been that whenever one uses some operations on strings, they will get internalized.
12:02:15  * juanjosanchezquit (Ping timeout: 260 seconds)
12:17:36  * c4milojoined
12:31:50  * bnoordhuisquit (Ping timeout: 240 seconds)
12:38:24  * iamdustanjoined
12:43:15  * juanjosanchezjoined
12:56:15  * juanjosanchezquit (Ping timeout: 245 seconds)
13:12:41  * bnoordhuisjoined
13:13:59  * xan_quit (Ping timeout: 272 seconds)
13:14:13  * leosterajoined
13:14:26  <leostera>hi there guys
13:14:36  * xan_joined
13:14:53  <leostera>i've been meaning to get into the guts of the beast but I'm not quite sure where to start
13:15:20  <leostera>anyone would have any pointers to really start understanding v8 and how to properly code js when using it?
13:17:47  <bnoordhuis>leostera: i believe the general advice is "don't optimize for v8, v8 should optimize for you"
13:18:48  <guor>just read crockford's book and don't use the stuff listed in the addendum "the bad parts"
13:18:57  <leostera>guor, I have
13:19:00  <leostera>bnoordhuis: thanks for that
13:19:21  <leostera>i'm just wondering how I can make my code even better
13:19:39  <bnoordhuis>leostera: v8 (and other js engines) really like it when your code is pretty much static
13:19:41  <leostera>particularly when running on top of v8
13:19:46  <bnoordhuis>code and data, actually
13:20:12  <guor>yup. make sure that the code is written as if javascript was a statically typed language
13:21:21  <leostera>ok, alright, an example of non static would be using the same variable that previously was an array to store the joined string of the array's elements?
13:21:38  <leostera>var a = a.join(',');
13:21:46  <leostera>instead of var str = a.join(','); ?
13:22:03  <guor>nah. non static would be, for example, adding properties to an object after construction
13:22:45  <guor>the compiler can deal with using different types for the same variable, since variables are just names of stack and context slots really
13:22:45  <bnoordhuis>leostera: var o = { x: Math.random() < 0.5 ? 42 : "42" } <- don't do things like that
13:23:21  <guor>also, for the time being, if you use try-catch, use it in a wrapper function, don't wrap a try-catch around a huge block of code inline
13:23:22  <leostera>guor: that's the stuff that what I want to learn
13:23:23  <bnoordhuis>that's not the worst thing you could, actually
13:23:31  <leostera>guor: yeah, that one I knew
13:23:36  <bnoordhuis>guor: hasn't that been fixed?
13:23:42  <guor>unfortunately, no :/
13:23:52  <guor>try catch is still not optimized for
13:24:03  <bnoordhuis>oh. i thought i saw patches land for that
13:24:26  <bnoordhuis>hrm, maybe time to revisit some code in node's lib/ dir
13:24:33  <guor>:)
13:25:06  <leostera>ok, this is good stuff
13:25:17  <leostera>I appreciate the tips given
13:25:24  <guor>don't use double equal, use triple equal
13:25:50  <leostera>anything regarding new/delete ?
13:25:54  <guor>also, no arguments object
13:25:59  <guor>yeah. don't use delete :P
13:26:02  <bnoordhuis>leostera: don't use delete
13:26:06  <bnoordhuis>right :)
13:26:10  <guor>delete totally screws up the object layout
13:26:15  <leostera>why?
13:26:20  <leostera>oh, I see
13:26:26  <leostera>what does that mean?
13:26:33  <bnoordhuis>leostera: think of a c struct
13:26:40  <bnoordhuis>that's what v8 tries to turn your object into
13:26:49  <bnoordhuis>that is, a chunk of memory with values at fixed addresses
13:27:03  <bnoordhuis>if you start adding/deleting things, that no longer works, the addresses don't remain fixed
13:27:16  <leostera>right
13:27:30  <bnoordhuis>it then gets turned into what is essentially a hash table
13:27:32  <leostera>so keeping my objects static lets v8 optimize them
13:27:37  <guor>yup
13:27:37  <bnoordhuis>exactly
13:27:56  <leostera>so when you say the Math.random thing
13:28:03  <bnoordhuis>also, keep your functions short else they won't inline
13:28:04  <leostera>does v8 try to predict something there?
13:28:22  <Petka>and the good parts are even worse for perf than the bad parts :P
13:28:23  <bnoordhuis>ah, you might want to google for 'hidden class'
13:28:28  <guor>that's actually a recent addition, we try to use specific representations for properties
13:29:05  <leostera>bnoordhuis: yup, i've read some about it and watched the google video with lars explaining them
13:29:27  <leostera>i'll have to keep delving into it I guess
13:29:38  <guor>leostera, v8 doesn't really ever predict anything. instead it tries to observe past behavior
13:29:52  <leostera>so it's more of a retrospection
13:30:16  <guor>if it sees values of a certain type, it assumes for the future that same code sites will encounter the same type
13:30:22  <leostera>right
13:30:26  <guor>and optimizes for that assumption
13:30:30  <leostera>tha'ts how the optimizing compiler works, right?
13:30:36  <guor>if it turns out to be wrong, we go the slow path
13:30:39  <guor>right
13:30:42  <leostera>then if that assumption is proven wrong, it deoptimizes
13:30:50  <guor>but even before the optimizing compiler, we have inline caches
13:31:17  <guor>so like
13:31:27  <guor>if you load a property x of object o, like o.x
13:31:45  <guor>the first time you get there, we don't know anything yet, so we do the slow way of doing all necessary look ups
13:32:00  <guor>but then we embed the load as fast path into the code at that load site
13:32:29  <guor>the second time we get there, we check the type of the object o, and if it's the expected type, we just go the fast path
13:33:13  <guor>if you changed the object type, added properties inbetween etc, the check fails and we have to do the slow load all over again
13:37:49  <bnoordhuis>^ that's somewhat mitigated by polymorphic ICs
13:38:47  <leostera>awesome
13:38:56  <leostera>so as long as I keep my objects pretty much static
13:39:01  <leostera>I'll get most of the benefits
13:39:09  <bnoordhuis>yep
13:39:20  <leostera>would you recommend me to read any particular part of the source code of v8?
13:39:31  <guor>no :P
13:39:48  <guor>it's a huge mess
13:40:04  * juanjosanchezjoined
13:40:34  <leostera>haha ok
13:40:46  <leostera>i'll stick around this room but I have to leave now
13:41:16  <leostera>do you guys have any benchmarks I could use to compare how I do some things?
13:41:42  <bnoordhuis>leostera: http://wingolog.org/archives/2011/07/05/v8-a-tale-of-two-compilers <- kind of outdated but still reasonably relevant
13:42:05  <bnoordhuis>hm. that's kind of contradictionary, isn't it?
13:42:34  <bnoordhuis>let's say the basic concepts still apply
13:46:28  <leostera>thanks bnoordhuis
13:56:35  * juanjosanchezquit (Ping timeout: 260 seconds)
14:07:48  * jaseemabidquit (Ping timeout: 240 seconds)
14:31:22  <muelli>hm. can I remove strings from the cache? I.e. "uninternalize" them?
14:33:41  <bnoordhuis>muelli: don't think so
14:36:23  <muelli>yeah. I guess there is no reason to in the current design.
14:36:29  <muelli>Strings are expected to be immutable, right?
14:43:34  <bnoordhuis>yes
14:45:22  * leosteraquit (Quit: leostera)
14:49:02  <muelli>hm. but they do have a Set method.. weird
14:49:31  <muelli>hm. let me check what happens to internalized strings when chars are set...
14:53:21  <bnoordhuis>muelli: it's people like you that will one day bring back the Old Ones. "oh, i wonder what happens when i read chants from this book written in a dead language?"
14:53:58  <bnoordhuis>it'll end in tentacles, mark my words
14:58:21  <muelli>:D
15:00:22  <muelli>hm. yeah. It's broken as expected. My two Handle<String>s change their value... hm...
15:01:51  <muelli>maybe it should at least ASSERT that the string has not been internalized
15:22:28  <muelli>bnoordhuis: do you have any opinion?
15:29:34  <bnoordhuis>muelli: sorry, what's the question?
15:30:23  <muelli>bnoordhuis: should String::Set ASSERT(StringShape(this).IsInternalized() == false)?
15:31:28  <bnoordhuis>muelli: oh, right. yeah, i guess that makes sense
15:36:36  * Esailijajoined
15:36:44  <muelli>or maybe allocate new strings, but it'd be pretty weird to allocate new strings from within String::Set I suppose.
15:39:50  * Petkaquit (Ping timeout: 240 seconds)
15:42:06  * RT|Chatzillaquit (Quit: ChatZilla [Firefox])
16:20:18  * stalledquit (Ping timeout: 252 seconds)
16:26:10  <isaacbw>does v8 support const?
16:26:13  <isaacbw>right now
16:26:22  <guor>yes
16:26:56  <guor>though im not entirely sure how much of it is compatible with spidermonkey
16:28:44  <isaacbw>are there plans to bring it in line with es6's const spec?
16:28:49  <isaacbw>*proposal
16:29:18  <isaacbw>I see a fairly old discussion on the issue tracker
16:30:21  <guor>im not aware of any
16:31:01  <isaacbw>P.S for what it's worth I think 'val' would be a more aesthetic keyword than const
16:31:24  <guor>well I think there are more aesthetic languages than js :P
16:33:28  <isaacbw>amen to that
16:34:00  * stalledjoined
16:37:27  * juanjosanchezjoined
16:46:06  <bnoordhuis>i sense that isaacbw is a closet ML programmer
16:47:41  <isaacbw>I'm a closet ML programmer who hasn't used ML yet
16:48:20  <isaacbw>I think bnoordhuis is a not so closet ML programmer
16:48:52  <bnoordhuis>isaacbw: that's how it goes for a lot of people; happily married (to another programming language) for 20 years, then bam!, they find out they're into ML
16:49:05  <bnoordhuis>and yeah, i have a soft spot for ML :)
16:49:07  <isaacbw>haha
16:49:25  <isaacbw>poyfect
16:49:50  <guor>at university we had Ocaml in the first year
16:49:56  <guor>god I hated this language
16:50:06  <bnoordhuis>it takes some time to grow on you
16:50:11  <guor>but mainly because the professor made us do abominations with it
16:50:23  <guor>like, write a compression algoritm with it
16:50:31  <guor>or code on paper in exams
16:50:32  <bnoordhuis>be glad it wasn't SML, ocaml at least makes token gestures to practicality
16:50:47  <bnoordhuis>ah, the code on paper things - yeah, i've had that too
16:51:00  <bnoordhuis>awful and unnnatural is what it is
16:52:13  <bnoordhuis>guor: maybe give ocaml another spin, it's strikes a pretty decent balance between purity and practicality
16:52:22  <bnoordhuis>*it
16:52:27  <guor>maybe some other time :)
17:02:37  * Lethalmanquit (Read error: Connection reset by peer)
17:12:28  * juanjosanchezquit (Ping timeout: 240 seconds)
17:13:59  * juanjosanchezjoined
17:23:40  * bnoordhuisquit (Ping timeout: 265 seconds)
18:01:53  * spoluquit (Ping timeout: 272 seconds)
18:29:02  * bnoordhuisjoined
18:33:32  * bnoordhuisquit (Ping timeout: 256 seconds)
18:33:59  * c4miloquit (Remote host closed the connection)
18:34:32  * c4milojoined
18:36:07  * Lethalmanjoined
18:39:15  * c4miloquit (Ping timeout: 272 seconds)
18:49:01  * muelliquit (Ping timeout: 272 seconds)
19:06:58  * bnoordhuisjoined
19:37:42  * Esailijaquit (Quit: L�hd�ss�)
19:41:11  * c4milojoined
20:19:19  * c4miloquit (Remote host closed the connection)
20:19:53  * c4milojoined
20:24:10  * c4miloquit (Ping timeout: 245 seconds)
20:45:39  * juanjosanchezquit (Quit: Leaving)
20:58:58  * c4milojoined
21:00:56  * c4miloquit (Read error: Connection reset by peer)
21:01:30  * c4milojoined
21:03:34  * tabbott__quit (Read error: Connection reset by peer)
21:06:00  * tabbott_joined
21:12:50  * iamdustanquit (Ping timeout: 264 seconds)
21:32:41  * Lethalmanquit (Read error: Connection reset by peer)
21:37:31  * c4miloquit (Remote host closed the connection)
22:16:09  * RT|Chatzillajoined
22:34:09  * C-Manquit (Quit: Connection reset by beer)
22:41:15  * bnoordhuisquit (Ping timeout: 245 seconds)
23:31:06  * c4milojoined
23:34:50  * c4miloquit (Remote host closed the connection)
23:35:09  * c4milojoined