Skip to content

Commit b66def5

Browse files
feat(versionaware): gate prebuilt tables behind build tag, use flat globals
Move codes_gen.go behind //go:build prebuilt_tables. Without the tag, Tables/Revisions are empty and all resolution happens via lazy JAR extraction from the device. Replace nested CompiledTable literals with flat global vars (one per method slice, one per version table). The Go compiler statically initializes flat globals in the data segment, eliminating runtime init code entirely (9.48MB map.init → 0 init code). Results (x86): - Default binary (no prebuilt): 112MB, 45ms startup - Prebuilt binary (flat globals): 123MB, 52ms startup - Original (map init): 124MB, 80ms startup
1 parent 1d12fc2 commit b66def5

3 files changed

Lines changed: 516527 additions & 434427 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//go:build !prebuilt_tables
2+
3+
package versionaware
4+
5+
// DefaultAPILevel is the API level that the compiled proxy code was
6+
// generated against. Without prebuilt_tables, transaction codes are
7+
// resolved dynamically from device framework JARs.
8+
var DefaultAPILevel int
9+
10+
// Tables is empty without prebuilt_tables; all resolution happens
11+
// via lazy JAR extraction.
12+
var Tables MultiVersionTable
13+
14+
// Revisions is empty without prebuilt_tables.
15+
var Revisions = APIRevisions{}

0 commit comments

Comments
 (0)