github.com/jochenboesmans/gedcom-parser@v1.0.4/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/jochenboesmans/gedcom-parser/parse"
     5  	"os"
     6  	"runtime/pprof"
     7  	"testing"
     8  )
     9  
    10  func BenchmarkParseITISGedToJson(b *testing.B) {
    11  	cpuFile, err := os.Create("cpu.prof")
    12  	if err != nil {
    13  		return
    14  	}
    15  	err = pprof.StartCPUProfile(cpuFile)
    16  	if err != nil {
    17  		return
    18  	}
    19  	parse.Parse("examples/ITIS.ged", "test-output/ITIS.json")
    20  	pprof.StopCPUProfile()
    21  
    22  	memFile, err := os.Create("mem.prof")
    23  	if err != nil {
    24  		return
    25  	}
    26  	err = pprof.WriteHeapProfile(memFile)
    27  	if err != nil {
    28  		return
    29  	}
    30  
    31  }
    32  
    33  func BenchmarkParseITISJsonToGed(b *testing.B) {
    34  	//b.ReportAllocs()
    35  	//parse.Parse("test-output/ITIS.json", "test-output/ITIS.ged")
    36  }