00:00:00 --- log: started forth/08.07.05 00:05:01 have you looked at how high performance prototype OO languages implement things? 00:05:36 Not I ( knowingly knowing everyone knew). 00:06:03 so suppose you have an object, { x: 10, y: 20 } 00:06:05 representing a point 00:06:18 you can store it as a pair 00:06:27 first element of the pair is a hashtable, { x: 0, y: 1 } 00:06:32 second element is an array, { 10, 20 } 00:06:56 if i clone the object, i make a new pair. i clone the sequence, but share the hashtable 00:07:31 if i add an attribute to the object, i clone its hashtable if its shared, add a new field to the hashtable (eg, z: 2) then grow the sequence by 1 00:07:41 so suppose this sequence of events occurs 00:07:46 i make an object { x: 10, y: 100 } 00:07:49 i clone it, change x to 30 00:07:56 then i clone it again, and add an attribute z: -5 00:08:00 now i have three objects 00:08:04 { x: 10, y: 100 } 00:08:07 { x: 30, y: 100 } 00:08:13 { x: 30, y: 100, z: -5 } 00:08:24 the first two objects share their hashtable which maps slot names to offsets (this is called a 'map') 00:08:36 the third object has a different map from the first two 00:11:57 Have I seen this before in Python, when I used to see Python? In regards to dictionaries? 00:12:48 * Raystm2 goes to look. 00:13:06 yes, the syntax is very python 00:13:16 actually, more javascript 00:13:24 in python, the keys have to be explicit string constants 00:13:35 I see. I've never Java'd before. I'm at a loss here. 00:13:39 the only language i know of taht implements this is self 00:13:51 you save a lot of memory by only storing the slot values in each instance 00:13:59 and sharing a map of slot names to offsets between instances with the same 'shape' 00:14:06 the map functions like a class definition, except its behind the scenes and implicit 00:14:52 aum: does that make sense? 00:14:52 Okay, I understand that. ty. 00:15:04 now suppose you have a word, : distance ( point -- n ) dup :x dup * swap :y dup * + sqrt ; 00:15:15 where :x and :y access fields x and y 00:15:20 just picking an arbitrary syntax here 00:15:32 * Raystm2 following... 00:15:39 :x looks up "x" in the object's map to get an offset, then reads that offset from its values array 00:15:44 ditto for y 00:15:48 so that word is kind of inefficient 00:15:57 however, the self vm is always doing some profiling behind the scenes 00:16:14 if it notices that you're calling 'distance' a lot with objects of a certain map, then it converts it to something like this, 00:16:57 : distance ( point -- n ) dup map-of 12345 = if slots dup @ dup * swap cell + @ dup * + sqrt else dup :x dup * swap :y dup * + sqrt then ; 00:17:11 where 12345 is the address of the map which is coming up frequently in the profile 00:17:31 so if you call distance on a bunch of points, all having the same map, in a long loop, eventually distance will be recompiled to optimize for this case 00:17:54 this is what self did, and it achieved pretty competitive performance, given enough 'warm up', despite being extremely dynamic 00:18:02 of course, the self VM is about 200,000 lines of dense C++... 00:18:24 :) 00:18:51 Neat kind of optimization. A good lesson. 00:38:31 aum: i've been reading your link off and on ever since you posted it. This is all very interesting. 00:39:16 Don't know why i've not tried FICL at this point, but now there is a reason. :) 01:22:23 * aum is back 01:22:42 * slava just finished up messing around with factor's turnkey deploymeny tool 01:22:58 Raystm2: i'll soon be packaging up all my code as an add-on package which supplements standard FICL 01:23:05 a console hello world comes in at 340kb, gui hello world comes in at around 1 mb 01:23:18 eek 01:23:29 that's damn small compared to lisp systems 01:23:35 makes factor sound like a concatenative cousin of Ada 01:23:36 and it has no dependencies 01:23:50 oh, that's different 01:24:11 well, i'm not counting the factor vm executable here. it's 187kb. 01:24:18 1MB is comparable to deployed python standalones 01:24:43 yeah, and its all native code, so you cannot reverse engineer anything without considerable effort 01:25:06 that might be handy for corporate users 01:25:27 mostly it means there's no interpretation 01:25:38 that's really good 01:25:46 strangely, the 'maze' opengl demo is 953kb 01:25:48 a bit smaller than hello world 01:25:56 it doesn't use text rendeing, so that code gets stripped out 01:26:48 so an MS versionj doesn't use any standard MS DLLs? 01:27:15 well, on Windows it bundles itself with freetype.dll, but that's temporary since eventually we'll use native text rendering 01:27:38 and it does use system DLLs on windows of course, kernel32, gdi32, etc 01:27:48 its just not like java where you need a 15mb runtime environment :) 01:28:01 hehehe 01:28:05 nothing is like java :P 01:28:36 well, most lisp systems are, in the sense that the runtime is a monolithic chunk which you cannot strip down and bundle with your program 01:28:44 you can pack a java hello world standalone's windows installer down to about 8MB though - the JRE license allows a lot of stuff to get stripped out 01:29:03 yeah but its not like factor's deploy tool, which decides what to keep and throw out automatically, on a per-word basis 01:29:06 based on what can get called or not 01:29:26 sounds like Factor is also a mega-efficient wheel-reinvention mill ;) 01:29:30 it also strips out stuff like word names (but there's a flag to keep those in, for debugging or if your program actually wants to look up words at runtime) 01:29:57 does factor have its own TCP/IP stack? 01:30:22 no 01:30:40 i have a high level wrapper around unix and windows sockets though 01:30:43 to hide platform specific aspects 01:30:49 that's always smart 01:31:09 a more complex demo, 'Bunny', downloads a 3d model via http and renders it with opengl 2.0 features such as fragment shaders 01:31:12 it deploys at 2mb 01:31:13 low-level socket programming is full of nasty red tape, so wrappers are always a blessing 01:31:25 here is a time server in factor, 01:31:27 01:31:30 "time" >>name 01:31:35 1234 >>inseure 01:31:39 1234 >>insecure 01:31:51 [ now timestamp>string print ] >>handler 01:31:52 start-server 01:32:07 spawns a thread for every connection 01:32:10 logs connections 01:32:14 yikes, that's severely high-level 01:32:17 listens on port 1234 01:32:21 we can add this before 'start-server', 01:32:24 100 >>max-connections 01:32:26 or this, 01:32:29 12345 >>secure 01:32:35 now it listens for SSL connections on port 12345 01:32:52 so you've done all the X.509 stuff then? 01:33:01 i have a high-level wrapper around openssl 01:33:06 ohh, ok 01:33:14 nice lib 01:33:17 "https://www.amazon.com" http-get 01:33:38 have you got a libffi wrapper? 01:33:44 i don't use libffi, i have my own ffi 01:33:53 LIBRARY: foo 01:33:56 platform-independent? 01:34:00 FUNCTION: int my_function ( int x, double y, char* string ) ; 01:34:04 1 5.0 "hello" my_function . 01:34:06 => 666 01:34:11 yes 01:34:27 it supports structs, unions, function pointers (calling function pointers that C gives us, and passing factor words as function pointers to C) 01:34:33 impressive 01:34:48 what's the basic strategy for platform-independent ffi in C? 01:35:01 there is none 01:35:08 its platform-specific and involves code generation 01:35:17 ok 01:35:26 are you vulnerable to gcc changes? 01:35:28 i have a regression test suite that i run on 11 platforms to make sure the ffi works 01:35:39 no, C ABIs are pretty stable 01:35:45 unlike C++ which changes with gcc point releaess :) 01:35:52 right 01:36:03 ABI means the call frame format? 01:36:14 yeah, and what registers values are passed in, etc 01:36:19 it varies by CPU obviously, but also by OS in the same CPU 01:36:26 eg, Linux/PPC and Mac OS X/PPC have totally different ABIs 01:36:38 Windows/x86, Linux/x86 and Mac OS X/x86 are similar but there are minor variations 01:36:45 do you virtualise for your tests, or do you have a very warm machine room? 01:37:27 two machines at my house, 7 at the office, one of which runs 4 VMs 01:37:47 is factor a major part of your day-job? 01:38:19 yes 01:38:38 you're very fortunate there 01:38:51 how do you generate revenue from it, if you don't mind me asking? 01:38:59 i can't reveal that, sorry 01:39:03 there will be announcements in due time 01:39:46 embedded military software systems can be a very sensitive topic :P 01:55:05 --- join: kar8nga (n=kar8nga@AMarseille-151-1-63-26.w82-122.abo.wanadoo.fr) joined #forth 02:16:55 --- join: qFox (i=C00K13S@234pc222.sshunet.nl) joined #forth 04:49:17 --- part: kar8nga left #forth 04:49:58 --- quit: aum ("Leaving") 07:37:53 --- join: sixforty (n=sixforty@204.110.227.11) joined #forth 07:52:33 --- join: Al2O3 (n=Al2O3@71.33.245.81) joined #forth 08:06:24 --- quit: qFox ("Time for cookies!") 08:14:54 --- quit: Al2O3 () 08:40:08 --- join: Al2O3 (n=Al2O3@c-76-120-53-32.hsd1.co.comcast.net) joined #forth 08:53:48 --- quit: sixforty ("Leaving.") 09:46:46 --- join: kar8nga (n=kar8nga@AMarseille-151-1-63-26.w82-122.abo.wanadoo.fr) joined #forth 10:44:58 --- join: alexshendi (n=user@dslb-092-074-166-163.pools.arcor-ip.net) joined #forth 10:47:28 --- mode: ChanServ set +o crc 11:04:57 ls 11:05:21 Oops, sorry 11:21:55 --- quit: Al2O3 () 11:23:24 --- join: ecraven (n=nex@plc31-103.linzag.net) joined #forth 11:44:22 --- quit: kar8nga ("Leaving.") 12:35:23 --- join: kar8nga (n=kar8nga@AMarseille-151-1-63-26.w82-122.abo.wanadoo.fr) joined #forth 13:31:11 --- join: craigoz (n=craigo@202.63.56.72) joined #forth 13:34:02 --- join: Al2O3 (n=Al2O3@c-76-120-53-32.hsd1.co.comcast.net) joined #forth 13:42:29 --- quit: ecraven ("bbl") 13:50:27 --- join: ams (i=ams@gnu/inetutils/ams) joined #forth 13:54:02 i hate the fact that i like forth more than lisp now... 15:13:14 --- part: kar8nga left #forth 16:13:19 --- join: Al2O3_ (n=Al2O3@c-76-120-53-32.hsd1.co.comcast.net) joined #forth 16:28:44 --- quit: Al2O3 (Read error: 110 (Connection timed out)) 16:59:13 --- quit: Al2O3_ () 19:10:41 --- join: aum (n=aum@60-234-243-247.bitstream.orcon.net.nz) joined #forth 19:24:40 --- quit: aum ("Leaving") 19:59:30 --- join: madgarden (n=madgarde@CPE001d7e527f89-CM00159a65a870.cpe.net.cable.rogers.com) joined #forth 20:30:23 --- quit: nighty^ (Read error: 104 (Connection reset by peer)) 20:41:19 --- join: ttuttle (n=tom@vps.ttuttle.net) joined #forth 20:41:26 --- part: ttuttle left #forth 20:55:36 --- join: Grackle_ (n=alex@164-207.suscom-maine.net) joined #forth 21:49:20 --- quit: gnomon ("Leaving") 22:11:41 --- quit: Quartus` (Read error: 104 (Connection reset by peer)) 22:30:15 --- join: nighty^ (n=nighty@x122091.ppp.asahi-net.or.jp) joined #forth 23:16:03 --- join: zedas (n=zedas@67-207-134-146.slicehost.net) joined #forth 23:59:59 --- log: ended forth/08.07.05