Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-26 Thread Jim Wilcoxson
When we evaluated 3.4 performance (TCL 7.6 and 8x) vs. 2.3.3 (TCL 7.4), one thing I compared was a 10-line loop to load an ns_share array. The loop contained maybe 8-10 string operations on a string of around 200 characters, and a single set command with an ns_share array lvalue. One execution

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-26 Thread Jeff Hobbs
Jim Wilcoxson wrote: ... I couldn't find the exact benchmark results just now, but it was something along the lines of 3.4 w/7.6 being 80-90% faster than 2.3.3/7.4, and 3.4 w/8x being only 25% faster. So in this case, the TCL 8x compiling and faster string operations were greatly

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-26 Thread Jim Wilcoxson
Thanks for the info Jeff. My understanding is that the TCL 7.6 ns_share stuff is hacked into the TCL interpreter variable handler, while the 8x ns_share routines use variable traces. I had wondered about using the C variable facility to do ns_shares but haven't messed with it. It seems

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-26 Thread Rob Mayoff
+-- On Feb 26, Jeff Hobbs said: Also, I believe you implied that you were using a proc, but it is important to note that toplevel code will be slower if large loops are used without putting them in procs. This is by design. And boy was that annoying when we (ArsDigita) wanted to

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-25 Thread Jeff Hobbs
The Tcl 'expr' command works with signed integers, whatever the size of an int is on your platform. However, it is just a stream of bits, so when you have your number, just do: format %u -1 However, note that this number is really for viewing only, because as soon as expr gets it again,

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-25 Thread Vlad Seryakov
You can try these functions: proc inet_addr { ipaddr } { set addr [binary format c4 [split $ipaddr .]] binary scan $addr i bin return $bin } proc inet_ntoa { ipaddr } { set bin [binary format i $ipaddr] binary scan $bin a b c d set a [expr { ($a + 0x100) % 0x100

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-25 Thread Dossy
On 2002.02.25, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have come up with a function to convert the Long IP into Dotted Quad format, [...] I've been thinking about writing a proc net for a while that exposes [net inet_ntoa $long] for a while, but ... I'm lazy. proc inet_ntoa {long} {

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-25 Thread Dossy
On 2002.02.25, Rob Mayoff [EMAIL PROTECTED] wrote: +-- On Feb 25, [EMAIL PROTECTED] said: Can anyone help figure out why expr will not accept any values bigger than that, Because your Tcl interpreter uses 32-bit signed integers. proc dotted_ip_from_long {n} { binary scan

Re: [AOLSERVER] Help with Dotted IP conversion

2002-02-25 Thread JamesRanson
Thanks Dossy -- worked like a charm. I tried the binary method but apparently binary is not an available command in TCL 7.6 (don't shoot me I'm not the web admin, I just write the code ;) As always, you guys are a great help!