============================================================================ Size Comparison (run once to print sizes) ============================================================================
(t *testing.T)
| 871 | // ============================================================================ |
| 872 | |
| 873 | func TestPrintSerializedSizes(t *testing.T) { |
| 874 | f := newFory() |
| 875 | if schemaMismatchEnabled() { |
| 876 | numericStruct := CreateNumericStruct() |
| 877 | foryStructData, _ := f.Serialize(&numericStruct) |
| 878 | sample := CreateSample() |
| 879 | forySampleData, _ := f.Serialize(&sample) |
| 880 | mediaContent := CreateMediaContent() |
| 881 | foryMediaData, _ := f.Serialize(&mediaContent) |
| 882 | structList := CreateNumericStructList() |
| 883 | foryStructListData, _ := f.Serialize(&structList) |
| 884 | sampleList := CreateSampleList() |
| 885 | forySampleListData, _ := f.Serialize(&sampleList) |
| 886 | mediaContentList := CreateMediaContentList() |
| 887 | foryMediaContentListData, _ := f.Serialize(&mediaContentList) |
| 888 | |
| 889 | fmt.Println("============================================") |
| 890 | fmt.Println("Serialized Sizes (bytes):") |
| 891 | fmt.Println("============================================") |
| 892 | fmt.Printf("NumericStruct:\n") |
| 893 | fmt.Printf(" Fory: %d bytes\n", len(foryStructData)) |
| 894 | fmt.Printf("Sample:\n") |
| 895 | fmt.Printf(" Fory: %d bytes\n", len(forySampleData)) |
| 896 | fmt.Printf("MediaContent:\n") |
| 897 | fmt.Printf(" Fory: %d bytes\n", len(foryMediaData)) |
| 898 | fmt.Printf("NumericStructList:\n") |
| 899 | fmt.Printf(" Fory: %d bytes\n", len(foryStructListData)) |
| 900 | fmt.Printf("SampleList:\n") |
| 901 | fmt.Printf(" Fory: %d bytes\n", len(forySampleListData)) |
| 902 | fmt.Printf("MediaContentList:\n") |
| 903 | fmt.Printf(" Fory: %d bytes\n", len(foryMediaContentListData)) |
| 904 | fmt.Println("============================================") |
| 905 | return |
| 906 | } |
| 907 | |
| 908 | // NumericStruct sizes |
| 909 | numericStruct := CreateNumericStruct() |
| 910 | foryStructData, _ := f.Serialize(&numericStruct) |
| 911 | pbStructData, _ := proto.Marshal(ToPbStruct(numericStruct)) |
| 912 | msgpackStructData, _ := msgpack.Marshal(numericStruct) |
| 913 | |
| 914 | // Sample sizes |
| 915 | sample := CreateSample() |
| 916 | forySampleData, _ := f.Serialize(&sample) |
| 917 | pbSampleData, _ := proto.Marshal(ToPbSample(sample)) |
| 918 | msgpackSampleData, _ := msgpack.Marshal(sample) |
| 919 | |
| 920 | // MediaContent sizes |
| 921 | mediaContent := CreateMediaContent() |
| 922 | foryMediaData, _ := f.Serialize(&mediaContent) |
| 923 | pbMediaData, _ := proto.Marshal(ToPbMediaContent(mediaContent)) |
| 924 | msgpackMediaData, _ := msgpack.Marshal(mediaContent) |
| 925 | |
| 926 | // NumericStructList sizes |
| 927 | structList := CreateNumericStructList() |
| 928 | foryStructListData, _ := f.Serialize(&structList) |
| 929 | pbStructListData, _ := proto.Marshal(ToPbNumericStructList(structList)) |
| 930 | msgpackStructListData, _ := msgpack.Marshal(structList) |
nothing calls this directly
no test coverage detected