Re: Data structure run-time in tcl...

Aric Bills <aric.bills@xxxxxxxxx> writes:

On Jul 11, 1:17 pm, Eric Thorne <et.newsgro...@xxxxxxxxx> wrote:
God day tcl-ers...

I'm a long time perl user new to tcl and wrapping my head around non-
perl based hash data structures is proving difficult for me.

For those of you that know perl, imagine this:

Thoughts, ideas?


Here are three possible approaches, any of which will speed things up
for you:

Method 2: flat Tcl associative array

if { [regexp {(\S+)_X(\d+)Y(\d+)} $tile full_match type x y] } {
lappend counts($type,X,$y) $x
lappend counts($type,Y,$x) $y

Method 2 doesn't give you a dict or nested data, but arrays can be
converted to dicts and many of the things you might need nesting for
you can fake or work around. This is the fastest of the three methods
both for data storage and retrieval. If $type, $x, or $y can contain
commas, you'd need to choose a different delimiter.

Or simply construct the key using [list $type Y $x], etc.

So long,
Andreas Kupries <akupries@xxxxxxx>
Developer @ <>