AOLserver Chat Logs

2008/05/01

IRC [11:25] *** holycow joined the chat.
IRC [13:13] <Dossy> Quiet day? Everyone okay?
IRC [13:54] <partymola> yeah
IRC [13:54] <partymola> oh, dossy, i got weird behaviour with ns_db 0or1row
IRC [13:54] <partymola> if the query returns 0 rows
IRC [13:54] <partymola> i.e. set row [ns_db 0or1row $db $sql]
IRC [13:54] <partymola> then i can't do [ns_set size $row]
IRC [13:55] <partymola> i am given a VERY weird error
IRC [13:55] <partymola> let me resee it
IRC [13:55] <Dossy> yeah, what error?
IRC [13:56] <EvilOtto> 0or1row returns a null string on 0 rows
IRC [13:56] <partymola> no such set: while executing "ns_set size $row"
IRC [13:56] <Dossy> well, right - there were no rows returned.
IRC [13:56] <partymola> :/ it'd be nice to get a empty ns_set
IRC [13:57] <Dossy> yes, I think that's a poor design, but it's been the way it's been for a while.
IRC [13:57] <partymola> ok
IRC [13:57] <Dossy> I agree. But, changing that now is likely to break any code that depends on its current weird behavior. :)
IRC [13:57] <partymola> yes, yes
IRC [13:57] <Dossy> If it were inconsistent, I'd consider it a bug ...
IRC [13:57] <Dossy> I never use 0or1row anyway. I always use exec, bindrow, getrow.
IRC [13:57] <partymola> i am going to document it :)
IRC [13:57] <Dossy> I guess for efficiency, having a single command might be good - but, I'm not that worried.
IRC [13:57] <Dossy> Please do! I'm sure others will benefit.
IRC [13:57] <EvilOtto> I imagine it's that way to avoid the overhead of allocating a ns_set when its not necessary to.
IRC [13:58] <Dossy> Right.
IRC [13:58] <Dossy> An empty ns_set is a lot more expensive than an empty Tcl_Obj.
IRC [13:58] <EvilOtto> it is documented. http://dev.aolserver.com/wiki/Ns_db - " This command expects the SQL to be a select statement that returns exactly zero or one row. On zero rows, a null string is returned. On one row, a newly allocated ns_set is returned. An error is thrown if more then one row is returned."
IRC [13:58] <Dossy> And, if you're using 0or1row as an optimization over exec/bindrow/getrow, then - well, you SHOULD care that an empty ns_set is a waste.
IRC [13:58] <partymola> making me wonder what is failing for more then 15 minutes is a lot more expensive than an empty ns_set :D
IRC [13:58] <Dossy> EvilOtto: thanks for R'ing the FM. :)
IRC [13:59] <EvilOtto> try dealing with unicode in perl :/
IRC [13:59] <partymola> oh, i see :O
IRC [13:59] <EvilOtto> partymola, although if you consider the current docs insufficient, I heartily encourage you to augment them. It is a wiki after all.
IRC [14:03] <Dossy> The latest subject on the AOLserver mailing list is "how do we measure memory usage" - boy, that's a large topic.
IRC [14:03] <Dossy> And, the short-form answer of "read the code, see how memory is used, then count it" isn't sufficient. Sigh.
IRC [14:04] <Dossy> It might be interesting to use a debugging memory allocator that collects stats.
IRC [14:04] <partymola> Yes, and tcl has no functions to measure how many bytes has allocated a given structure / variable
IRC [14:04] <Dossy> There IS some Tcl allocator statistics actually, but they're not supported. :-(
IRC [14:04] <partymola> really? :O
IRC [14:04] <Dossy> AOLserver tries to get at them through the [ns_info pools] command.
IRC [14:05] <Dossy> That digs out the Tcl allocator stats on the threaded allocator memory pools.
IRC [14:05] <Dossy> However, the stats are inaccurate because, well, they're not supported - so not everything gets tracked correctly.
IRC [14:05] <Dossy> Once upon a time, while I was at AOL, we tried to see what it'd take to make the stats accurate ... and gave up.
IRC [14:07] <Dossy> Time to do some more shopping -- building another machine -- effectively got a 15% discount at TigerDirect.com
IRC [14:07] <Dossy> A month ago I built a box based on an Intel E8400 and really like it. I think I'll build another.
IRC [14:13] <partymola> A month ago I bought a Dell laptop... 2Gb RAM, Dual 64 bits processor... and only 399 euro. I LOVE IT!!
IRC [14:23] <EvilOtto> the existing memory allocation info does give a few useful bits, like hoy manu objects of which sizes are allocated and the overall waste... so one could reasonably guess that the 2 million objects of 24 bytes each are Tcl_Objs, for example
IRC [14:23] <EvilOtto> 399 euro - that's like $1500 usd, right?
IRC [14:27] <Dossy> :)
IRC [14:27] <Dossy> EvilOtto: yeah. it's not to-the-penny accounting, by any means.
IRC [14:28] <Dossy> Grr. I might want a XP activation key for this new machine--I should go dumpster diving.
IRC [14:35] <partymola> EvilOtto: the euro is starting to drop :S
IRC [14:36] <partymola> http://finance.yahoo.com/currency/convert?from=EUR&to=USD&amt=1&t=3m
IRC [14:40] <Dossy> Hm. For the same price as a E8400, I can get a Q6600. I wonder what the performance difference is.
IRC [16:05] *** KNReC joined the chat.
IRC [16:08] <KNReC> On the memory allocator front, KN did an experiment with 3.4 a long time ago where we added a stack-trace recorder & hash to the allocator on Windows (where we could use Bugslayer code to capture the stack). I don't think we've ported it up to 4.5, but I'll check.
IRC [16:09] <KNReC> Generally, we've been doing OK using valgrind for our memory problems for the last year.
IRC [18:22] *** Mooooooo joined the chat.
IRC [19:38] <Dossy> Yes, a stace-trace recorder is what I was thinking of. That, and a cracker of some common Tcl and AOLserver data structures that can also be recorded to give the collected data some relevant context.
IRC [19:39] <Dossy> But, yes--valgrind is a great starting point. I <3 valgrind with its various tools like helgrind, massif and memcheck.
IRC [19:40] <KNReC> I'll look around to see what we've got. KnowNow's going through a drastic change (well, really, a shutdown)...
IRC [19:41] <KNReC> We don't know what'll happen to the code yet. I'm hoping to be submitting a bunch of our stuff back starting 5/13, but I don't know if that'll happen or not.
IRC [19:42] <KNReC> I'm at least hoping to submit our utiliteis (including the memory stuff), our URITemplate (Tcl-on-RESTful-rails?) and our spnego stuff.
IRC [19:42] <KNReC> None of that is the core intellectual property, and it's all relatively normal C/Tcl module stuff.
IRC [19:43] <KNReC> (Well, C++, not C, but it compiles on Windows, Linux, & solaris using the AOLServer build stuff).
IRC [22:57] *** KNReC parted the chat.
IRC [23:32] *** hgcphoenix joined the chat.