Пример #1
0
def check_all_times():
    for c in (codec.get_XML(),
              codec.get_XML2_test(),
              codec.get_Packed(),
              codec.get_Bach_beta(),
              codec.get_Binary1_beta()):
        check_time(c, all_msg)
Пример #2
0
def check_all_times():
    for c in (codec.get_XML(),
              codec.get_XML2_test(),
              codec.get_Packed(),
              codec.get_Bach_beta(),
              codec.get_Binary1_beta()):
        check_time(c, all_msg)
Пример #3
0
def all_encoding_stats(file_name):
    """output with default file_name:
Test file: cyphesis_atlas_XML_2000-03-27_no_obj.log
Msg count: 228
            uncompressed    gzip -9   bzip2 -9
XML               954.97      47.93      33.95
XML2_test         727.00      45.92      34.03
Packed            384.41      36.79      30.84
Bach_beta         478.61      39.11      31.35
Binary1_beta      380.54      38.58      32.26
Binary2_test      236.12      35.22      30.78


Test file: CyphesisClient_fromServerViewpoint2_no_obj.log
Msg count: 716
            uncompressed    gzip -9   bzip2 -9
XML               832.77      36.76      23.82
XML2_test         632.11      35.03      23.94
Packed            284.41      28.88      23.20
Bach_beta         373.68      31.91      23.28
Binary1_beta      277.63      30.53      24.04
Binary2_test      156.22      28.31      23.62


Test file: cyphesis_atlas_Packed_2001-07-13.log
Msg count: 4768
            uncompressed    gzip -9   bzip2 -9
XML              1250.59      27.39      14.17
XML2_test         910.63      23.97      13.20
Packed            405.12      17.34      12.67
Bach_beta         544.18      18.72      12.21
Binary1_beta      441.45      22.03      14.34
Binary2_test      260.30      19.02      13.23
    """
    print()
    print()
    print("Test file:",file_name)
    global all_msg
    xml_codec = codec.get_XML()
    #all_msg = xml_codec.decode(open(file_name).read())
    all_msg = file.read_file(file_name)
    print("Msg count:",len(all_msg))

    all_stats = []
    #XML size
    all_stats.append(calculate_stats(all_msg,xml_codec))

    #XML2 size
    all_stats.append(calculate_stats(all_msg,codec.get_XML2_test()))

    #Packed size
    all_stats.append(calculate_stats(all_msg,codec.get_Packed()))

    #Bach size
    all_stats.append(calculate_stats(all_msg,codec.get_Bach_beta()))

    #Binary1_beta size
    all_stats.append(calculate_stats(all_msg,codec.get_Binary1_beta()))

    #Binary2_test size
    all_stats.append(calculate_stats(all_msg,codec.get_Binary2_test()))

##    for name in binary2.attribute_type_dict.keys():
##        print name
##        binary2.discard_name = name
##        all_stats.append(calculate_stats(all_msg,codec.get_Binary2_test()))
##        all_stats[-1][0] = list(all_stats[-1][0])
##        all_stats[-1][0][0] = name
##    all_stats.sort(lambda e1,e2:cmp(e1[2][2],e2[2][2]))

    print()
    filter_types = ("uncompressed", "gzip -9", "bzip2 -9")
    print("            %10s %10s %10s" % filter_types)
    for stat in all_stats:
        print("%-13s %10.2f %10.2f %10.2f" % (
            stat[0][0], stat[0][2], stat[1][2], stat[2][2]))
Пример #4
0
def all_encoding_stats(file_name):
    """output with default file_name:
Test file: cyphesis_atlas_XML_2000-03-27_no_obj.log
Msg count: 228
            uncompressed    gzip -9   bzip2 -9
XML               954.97      47.93      33.95
XML2_test         727.00      45.92      34.03
Packed            384.41      36.79      30.84
Bach_beta         478.61      39.11      31.35
Binary1_beta      380.54      38.58      32.26
Binary2_test      236.12      35.22      30.78


Test file: CyphesisClient_fromServerViewpoint2_no_obj.log
Msg count: 716
            uncompressed    gzip -9   bzip2 -9
XML               832.77      36.76      23.82
XML2_test         632.11      35.03      23.94
Packed            284.41      28.88      23.20
Bach_beta         373.68      31.91      23.28
Binary1_beta      277.63      30.53      24.04
Binary2_test      156.22      28.31      23.62


Test file: cyphesis_atlas_Packed_2001-07-13.log
Msg count: 4768
            uncompressed    gzip -9   bzip2 -9
XML              1250.59      27.39      14.17
XML2_test         910.63      23.97      13.20
Packed            405.12      17.34      12.67
Bach_beta         544.18      18.72      12.21
Binary1_beta      441.45      22.03      14.34
Binary2_test      260.30      19.02      13.23
    """
    print
    print
    print "Test file:",file_name
    global all_msg
    xml_codec = codec.get_XML()
    #all_msg = xml_codec.decode(open(file_name).read())
    all_msg = file.read_file(file_name)
    print "Msg count:",len(all_msg)

    all_stats = []
    #XML size
    all_stats.append(calculate_stats(all_msg,xml_codec))

    #XML2 size
    all_stats.append(calculate_stats(all_msg,codec.get_XML2_test()))

    #Packed size
    all_stats.append(calculate_stats(all_msg,codec.get_Packed()))

    #Bach size
    all_stats.append(calculate_stats(all_msg,codec.get_Bach_beta()))

    #Binary1_beta size
    all_stats.append(calculate_stats(all_msg,codec.get_Binary1_beta()))

    #Binary2_test size
    all_stats.append(calculate_stats(all_msg,codec.get_Binary2_test()))

##    for name in binary2.attribute_type_dict.keys():
##        print name
##        binary2.discard_name = name
##        all_stats.append(calculate_stats(all_msg,codec.get_Binary2_test()))
##        all_stats[-1][0] = list(all_stats[-1][0])
##        all_stats[-1][0][0] = name
##    all_stats.sort(lambda e1,e2:cmp(e1[2][2],e2[2][2]))

    print
    filter_types = ("uncompressed", "gzip -9", "bzip2 -9")
    print "            %10s %10s %10s" % filter_types
    for stat in all_stats:
        print "%-13s %10.2f %10.2f %10.2f" % (
            stat[0][0], stat[0][2], stat[1][2], stat[2][2])