CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
show_speedtest1_rtree.tcl58 linesDownload Raw Back to test
1#!/usr/bin/tclsh2#3# This script displays the field of rectangles used by --testset rtree4# of speedtest1.  Run this script as follows:5#6#      rm test.db7#      ./speedtest1 --testset rtree --size 25 test.db8#      sqlite3 --separator ' ' test.db 'SELECT * FROM rt1' >data.txt9#      wish show_speedtest1_rtree.tcl10#11# The filename "data.txt" is hard coded into this script and so that name12# must be used on lines 3 and 4 above.  Elsewhere, different filenames can13# be used.  The --size N parameter can be adjusted as desired.14#15package require Tk16set f [open data.txt rb]17set data [read $f]18close $f19canvas .c20frame .b21button .b.b1 -text X-Y -command refill-xy22button .b.b2 -text X-Z -command refill-xz23button .b.b3 -text Y-Z -command refill-yz24pack .b.b1 .b.b2 .b.b3 -side left25pack .c -side top -fill both -expand 126pack .b -side top27proc resize_canvas_to_fit {} {28  foreach {x0 y0 x1 y1} [.c bbox all] break29  set w [expr {$x1-$x0}]30  set h [expr {$y1-$y0}]31  .c config -width $w -height $h32}33proc refill-xy {} {34  .c delete all35  foreach {id x0 x1 y0 y1 z0 z1} $::data {36    .c create rectangle $x0 $y0 $x1 $y137  }38  .c scale all 0 0 0.05 0.0539  resize_canvas_to_fit40}41proc refill-xz {} {42  .c delete all43  foreach {id x0 x1 y0 y1 z0 z1} $::data {44    .c create rectangle $x0 $z0 $x1 $z145  }46  .c scale all 0 0 0.05 0.0547  resize_canvas_to_fit48}49proc refill-yz {} {50  .c delete all51  foreach {id x0 x1 y0 y1 z0 z1} $::data {52    .c create rectangle $y0 $z0 $y1 $z153  }54  .c scale all 0 0 0.05 0.0555  resize_canvas_to_fit56}57refill-xy58