Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added synthetic benchmarks constructing larger json structures. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | ak-bug-6efa4f571af052-jsonc |
Files: | files | file ages | folders |
SHA1: |
f8b84da1d43aa46e3bf42fa3a5c168aa |
User & Date: | andreask 2013-12-11 23:23:18.184 |
Context
2013-12-11
| ||
23:29 | Switched validation from the C parser back to a shared Tcl implementation, regexp based. It is consistently faster. No overhead creating irrelevant data structures is main suspected cause. check-in: 5a645be338 user: andreask tags: ak-bug-6efa4f571af052-jsonc | |
23:23 | Added synthetic benchmarks constructing larger json structures. check-in: f8b84da1d4 user: andreask tags: ak-bug-6efa4f571af052-jsonc | |
23:20 | Fixed bug in json::dict2json. Nobody seems to have used this before. check-in: 05d128bcc8 user: andreask tags: ak-bug-6efa4f571af052-jsonc | |
Changes
Changes to modules/json/json.bench.
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | uplevel #0 [list source $index] unset ::dir package require tcllibc } } source [file join $self json.tcl] proc cat {f} { set c [open $f] set d [read $c] close $c return $d } # ### ### ### ######### ######### ######### ########################### ## Get all the possible implementations json::SwitchTo {} foreach e [json::KnownImplementations] { ::json::LoadAccelerator $e } # ### ### ### ######### ######### ######### ########################### ## Benchmarks. ## Just the parser, on the valid inputs for the testsuite. foreach impl [json::Implementations] { json::SwitchTo $impl | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | uplevel #0 [list source $index] unset ::dir package require tcllibc } } source [file join $self json.tcl] # ### ### ### ######### ######### ######### ########################### ## Helpers proc cat {f} { set c [open $f] set d [read $c] close $c return $d } proc iota {n} { set r {} while {$n > 0} { lappend r [json::string2json $n] incr n -1 } return $r } proc iota-dict {n} { set r {} while {$n > 0} { lappend r f$n [json::string2json $n] incr n -1 } return $r } # ### ### ### ######### ######### ######### ########################### ## Get all the possible implementations json::SwitchTo {} foreach e [json::KnownImplementations] { ::json::LoadAccelerator $e } # ### ### ### ######### ######### ######### ########################### ## Benchmarks. ## Just the parser, on the valid inputs for the testsuite. foreach impl [json::Implementations] { json::SwitchTo $impl if {$impl eq "tcl"} { set series {0 1 10 100 1000} } else { set series {0 1 10 100 1000} } bench_puts "=== === === === === ===" bench_puts "=== === === $impl ===" bench_puts "=== === === === === ===" bench_puts {=== test-data =========} foreach f [glob -nocomplain -directory $self/test-data *.json] { set in [cat $f] bench -desc "parse [file rootname [file tail $f]] ($impl)" -body { json::json2dict $in } bench -desc "validate [file rootname [file tail $f]] ($impl)" -body { json::validate $in } } foreach f [glob -nocomplain -directory $self/test-data *.bench] { set in [cat $f] bench -desc "parse [file rootname [file tail $f]] ($impl)" -body { json::json2dict $in } bench -desc "validate [file rootname [file tail $f]] ($impl)" -body { json::validate $in } } bench_puts {=== synthetic array =========} foreach n $series { set in [json::list2json [iota $n]] bench -desc "parse array-$n ($impl)" -body { json::json2dict $in } bench -desc "validate array-$n ($impl)" -body { json::validate $in } } bench_puts {=== synthetic object =========} foreach n $series { set in [json::dict2json [iota-dict $n]] bench -desc "parse object-$n ($impl)" -body { json::json2dict $in } bench -desc "validate object-$n ($impl)" -body { json::validate $in } } bench_puts {=== synthetic string =========} foreach n $series { set in [json::string2json [string repeat . $n]] bench -desc "parse string-$n ($impl)" -body { json::json2dict $in } bench -desc "validate string-$n ($impl)" -body { json::validate $in } } } # ### ### ### ######### ######### ######### ########################### ## Complete return # ### ### ### ######### ######### ######### ########################### ## Notes ... |