MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / BenchmarkTransactionMarshal

Function BenchmarkTransactionMarshal

transaction_benchmark_test.go:138–155  ·  view source on GitHub ↗

BenchmarkTransactionMarshal measures JSON serialization overhead

(b *testing.B)

Source from the content-addressed store, hash-verified

136
137// BenchmarkTransactionMarshal measures JSON serialization overhead
138func BenchmarkTransactionMarshal(b *testing.B) {
139 txn := createTestTransaction("source-001", "dest-001", "ref-001", 100.00)
140 txn.TransactionID = "txn-benchmark-001"
141 txn.CreatedAt = time.Now()
142 txn.MetaData = map[string]interface{}{
143 "order_id": "order-12345",
144 "customer_id": "cust-67890",
145 "description": "Payment for services",
146 }
147
148 b.ResetTimer()
149 for i := 0; i < b.N; i++ {
150 _, err := json.Marshal(txn)
151 if err != nil {
152 b.Fatal(err)
153 }
154 }
155}
156
157// BenchmarkTransactionUnmarshal measures JSON deserialization overhead
158func BenchmarkTransactionUnmarshal(b *testing.B) {

Callers

nothing calls this directly

Calls 2

createTestTransactionFunction · 0.85
FatalMethod · 0.45

Tested by

no test coverage detected