github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/query/benchmark/synthetic_results.txt (about)

     1  Machine: Jay's 64G desktop
     2  
     3  ToProto:
     4  
     5  WithPre:
     6        20	  95618541 ns/op	39861295 B/op	 1060078 allocs/op
     7        10	 123337381 ns/op	39863207 B/op	 1060098 allocs/op
     8        10	 123074097 ns/op	39860972 B/op	 1060079 allocs/op
     9        10	 124367722 ns/op	39861371 B/op	 1060075 allocs/op
    10        10	 123757496 ns/op	39861220 B/op	 1060065 allocs/op
    11        10	 122457428 ns/op	39860052 B/op	 1060058 allocs/op
    12  
    13  WithPost:
    14        50	  26482329 ns/op	 7302381 B/op	   16378 allocs/op
    15        20	  76642407 ns/op	26233380 B/op	  375368 allocs/op
    16        10	 115666361 ns/op	44890162 B/op	  734396 allocs/op
    17        10	 145024249 ns/op	58154125 B/op	 1093554 allocs/op
    18        10	 182033826 ns/op	82205568 B/op	 1452403 allocs/op
    19         5	 211619219 ns/op	95290499 B/op	 1810701 allocs/op
    20  
    21  ToJSON:
    22  
    23  WithPre:
    24         5	 301938626 ns/op	159623070 B/op	 2381725 allocs/op
    25         5	 333503304 ns/op	159609675 B/op	 2381678 allocs/op
    26         5	 334535254 ns/op	159629153 B/op	 2381746 allocs/op
    27         5	 321055201 ns/op	159587396 B/op	 2381601 allocs/op
    28         5	 328103871 ns/op	159593441 B/op	 2381622 allocs/op
    29         5	 320395192 ns/op	159584097 B/op	 2381590 allocs/op
    30  	
    31  WithPost:
    32         5	 235309354 ns/op	127446713 B/op	 2091298 allocs/op
    33         5	 280120027 ns/op	157664113 B/op	 2299809 allocs/op
    34         5	 323651674 ns/op	187598216 B/op	 2508103 allocs/op
    35         3	 365435908 ns/op	212152914 B/op	 2716581 allocs/op
    36         3	 428802503 ns/op	247529517 B/op	 2924863 allocs/op
    37         3	 461889070 ns/op	271865712 B/op	 3132284 allocs/op
    38  
    39  Down the rows, we vary the number of unique descendents from:
    40  1, 1000, 2000, 3000, 4000, 5000
    41  
    42  At 5000, there is no unique descendent. For PreTraverse, we expect the running
    43  time to be constant. For PostTraverse, we expect to become faster when there
    44  is more overlap, i.e., fewer unique descendents.
    45  
    46  For ToProto, we see that WithPost might have a chance of beating WithPre when
    47  there is a lot of overlap. However, when there is little overlap, WithPost
    48  can be almost twice as slow and takes twice as much memory.
    49  
    50  A similar story holds for ToJSON.
    51  
    52  Yes, WithPost avoids a lot of work when there is a lot of overlap. BUT, note
    53  that when we marshal the proto or JSON, we need to traverse every node.
    54  Hence, the actual gain is not much. Considering this, we shall just go for
    55  PreTraverse which is simpler and faster roughly half of the time.