ooxml

Check-in [47cf52d42b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Saving the [expr ...] is probably even a tiny little better.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | speed
Files: files | file ages | folders
SHA3-256: 47cf52d42be6a2bbe2f3ecd862d4ae90eb78f73f4b8db85a9f6a00f02f1573c3
User & Date: rolf 2019-08-08 19:03:08
Context
2019-08-08
20:19
Removed a bit useless code: lastRow, minCol and maxCol are only written, but never used. check-in: 03ff1d1e5c user: rolf tags: speed
19:03
Saving the [expr ...] is probably even a tiny little better. check-in: 47cf52d42b user: rolf tags: speed
18:51
Use a fast temporary lookup array for all elements of sharedStrings, to avoid repeated lsearch on a potential every growing list. Inside the loop: since new elements are always appended on the list, the pos of the new list is just the llength - 1. For my tests, this changes already speeds the writing up of almost 3 times. check-in: 2b3d6087ca user: rolf tags: speed
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

2229
2230
2231
2232
2233
2234
2235

2236
2237
2238
2239
2240
2241
2242
2243
2244

    foreach {n v} [array get cells] {
      if {[dict exists $v t] && [dict get $v t] eq {s} && [dict exists $v v] && [dict get $v v] ne {}} {
        set thisv [dict get $v v]
        if {[info exists lookup($thisv)]} {
          set pos $lookup($thisv)
        } else {

	  lappend sharedStrings $thisv
	  set pos [expr {[llength $sharedStrings] - 1}]
          set lookup($thisv) $pos
	}
        set obj(sharedStrings) 1
	dict set cells($n) v $pos
      }
    }
    unset -nocomplain n v







>

<







2229
2230
2231
2232
2233
2234
2235
2236
2237

2238
2239
2240
2241
2242
2243
2244

    foreach {n v} [array get cells] {
      if {[dict exists $v t] && [dict get $v t] eq {s} && [dict exists $v v] && [dict get $v v] ne {}} {
        set thisv [dict get $v v]
        if {[info exists lookup($thisv)]} {
          set pos $lookup($thisv)
        } else {
          set pos [llength $sharedStrings]
	  lappend sharedStrings $thisv

          set lookup($thisv) $pos
	}
        set obj(sharedStrings) 1
	dict set cells($n) v $pos
      }
    }
    unset -nocomplain n v