1 // Copyright 2013-2014 Frank Schroeder. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package properties 6 7 import ( 8 "fmt" 9 "testing" 10 ) 11 12 // Benchmarks the decoder by creating a property file with 1000 key/value pairs. 13 func BenchmarkLoad(b *testing.B) { 14 input := "" 15 for i := 0; i < 1000; i++ { 16 input += fmt.Sprintf("key%d=value%d\n", i, i) 17 } 18 b.ResetTimer() 19 for i := 0; i < b.N; i++ { 20 if _, err := Load([]byte(input), ISO_8859_1); err != nil { 21 b.Fatal(err) 22 } 23 } 24 } 25