From 00a5531b73455ac636ddc7b18482930477c2b368 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Tue, 28 May 2024 17:59:42 +0200 Subject: [PATCH] Grap macro. --- paper/graph_fifo_query_partition.grap | 45 +++---------- paper/graph_fifo_query_tag.grap | 45 +++---------- paper/graph_query_partition.grap | 66 +++++-------------- paper/graph_query_tag.grap | 55 +++------------- paper/legend.grap | 91 +++++++++++++++------------ paper/paper.ms | 9 +-- 6 files changed, 95 insertions(+), 216 deletions(-) diff --git a/paper/graph_fifo_query_partition.grap b/paper/graph_fifo_query_partition.grap index 09715ae..7e53ff2 100644 --- a/paper/graph_fifo_query_partition.grap +++ b/paper/graph_fifo_query_partition.grap @@ -24,46 +24,15 @@ copy "../data/fifo_partitions.d" thru X y_scale = 1000 - ## fifo1 fifo5 fifo10 fifo20 - #line from cx,$2/y_scale to cx,$4/y_scale - #line from cx,$5/y_scale to cx,$7/y_scale - #line from cx,$8/y_scale to cx,$10/y_scale - #line from cx,$11/y_scale to cx,$13/y_scale + # Since the first access to the data is massively slower than the + # following retrivials, the mustache doesn't provide a better + # understanding of the data. - #ty = $3 + line_no_mustache(cbfifo1, obfifo1, $3, red) + line_no_mustache(cbfifo5, obfifo5, $6, green) + line_no_mustache(cbfifo10, obfifo10, $9, black) + line_no_mustache(cbfifo20, obfifo20, $12, pink) - cbfifo1 = $3/y_scale - cbfifo5 = $6/y_scale - cbfifo10 = $9/y_scale - cbfifo20 = $12/y_scale - -.gcolor red - if (obfifo1 > 0) then {line from cx,cbfifo1 to ox,obfifo1} -.gcolor -.gcolor green - if (obfifo5 > 0) then {line from cx,cbfifo5 to ox,obfifo5} -.gcolor - if (obfifo10 > 0) then {line from cx,cbfifo10 to ox,obfifo10} -.gcolor pink - if (obfifo20 > 0) then {line from cx,cbfifo20 to ox,obfifo20} -.gcolor - - obfifo1 = cbfifo1 - obfifo5 = cbfifo5 - obfifo10 = cbfifo10 - obfifo20 = cbfifo20 ox = cx - - # fifo1 fifo5 fifo10 fifo20 -.gcolor red - bullet at cx,cbfifo1 -.gcolor -.gcolor green - bullet at cx,cbfifo5 -.gcolor - bullet at cx,cbfifo10 -.gcolor pink - bullet at cx,cbfifo20 -.gcolor X .G2 diff --git a/paper/graph_fifo_query_tag.grap b/paper/graph_fifo_query_tag.grap index ce8843c..64aec98 100644 --- a/paper/graph_fifo_query_tag.grap +++ b/paper/graph_fifo_query_tag.grap @@ -23,46 +23,15 @@ copy "../data/fifo_tags.d" thru X y_scale = 1000 - ## fifo1 fifo5 fifo10 fifo20 - #line from cx,$2/y_scale to cx,$4/y_scale - #line from cx,$5/y_scale to cx,$7/y_scale - #line from cx,$8/y_scale to cx,$10/y_scale - #line from cx,$11/y_scale to cx,$13/y_scale + # Since the first access to the data is massively slower than the + # following retrivials, the mustache doesn't provide a better + # understanding of the data. - #ty = $3 + line_no_mustache(cbfifo1, obfifo1, $3, red) + line_no_mustache(cbfifo5, obfifo5, $6, green) + line_no_mustache(cbfifo10, obfifo10, $9, black) + line_no_mustache(cbfifo20, obfifo20, $12, pink) - cbfifo1 = $3/y_scale - cbfifo5 = $6/y_scale - cbfifo10 = $9/y_scale - cbfifo20 = $12/y_scale - -.gcolor red - if (obfifo1 > 0) then {line from cx,cbfifo1 to ox,obfifo1} -.gcolor -.gcolor green - if (obfifo5 > 0) then {line from cx,cbfifo5 to ox,obfifo5} -.gcolor - if (obfifo10 > 0) then {line from cx,cbfifo10 to ox,obfifo10} -.gcolor pink - if (obfifo20 > 0) then {line from cx,cbfifo20 to ox,obfifo20} -.gcolor - - obfifo1 = cbfifo1 - obfifo5 = cbfifo5 - obfifo10 = cbfifo10 - obfifo20 = cbfifo20 ox = cx - - # fifo1 fifo5 fifo10 fifo20 -.gcolor red - bullet at cx,cbfifo1 -.gcolor -.gcolor green - bullet at cx,cbfifo5 -.gcolor - bullet at cx,cbfifo10 -.gcolor pink - bullet at cx,cbfifo20 -.gcolor X .G2 diff --git a/paper/graph_query_partition.grap b/paper/graph_query_partition.grap index 0c0e3a6..8e8ad59 100644 --- a/paper/graph_query_partition.grap +++ b/paper/graph_query_partition.grap @@ -1,8 +1,7 @@ .G1 copy "legend.grap" frame invis ht 3 wid 4 left solid bot solid -coord x 0,5000*2 y 0,350 -ticks left out from 0 to 350 by 50 +coord x 0,5000*2 y 0.05,350 log y ticks bot out from 1000 to 10000 by 1000 label left "Request duration" unaligned "for a partition (ms)" "(Median)" left 0.8 @@ -13,64 +12,29 @@ cbram = cbuncache = cbfifo = cbcache = cbsemi = 0 legendxleft = 1000 legendxright = 6500 -legendyup = 330 -legendydown = 230 +legendyup = 0.01 +legendydown = 0.0001 -boite(legendxleft,legendxright,legendyup,legendydown) -legend(legendxleft,legendxright,legendyup,legendydown) +#boite(legendxleft,legendxright,legendyup,legendydown) +#legend(legendxleft,legendxright,legendyup,legendydown) copy "../data/partitions.d" thru X cx = $1*2 y_scale = 1000000 - # ram cached fifo semi uncached - line from cx,$2/y_scale to cx,$4/y_scale - line from cx,$5/y_scale to cx,$7/y_scale - line from cx,$8/y_scale to cx,$10/y_scale - line from cx,$11/y_scale to cx,$13/y_scale - line from cx,$14/y_scale to cx,$16/y_scale + line_no_mustache(cbram, obram, $3, red) + line_no_mustache(cbcache, obcache, $6, black) + line_no_mustache(cbfifo, obfifo, $9, pink) + line_no_mustache(cbsemi, obsemi, $12, blue) + line_no_mustache(cbuncache, obuncache, $15, green) - #ty = $3 + #line_with_mustache(cbram, obram, $3, red, $2, $4) + #line_with_mustache(cbcache, obcache, $6, black, $5, $7) + #line_with_mustache(cbfifo, obfifo, $9, pink, $8, $10) + #line_with_mustache(cbsemi, obsemi, $12,blue, $11, $13) + #line_with_mustache(cbuncache,obuncache,$15,green, $14, $16) - cbram = $3/y_scale - cbcache = $6/y_scale - cbfifo = $9/y_scale - cbsemi = $12/y_scale - cbuncache = $15/y_scale - - if (obram > 0) then {line from cx,cbram to ox,obram} - if (obcache > 0) then {line from cx,cbcache to ox,obcache} -.gcolor pink - if (obfifo > 0) then {line from cx,cbfifo to ox,obfifo} -.gcolor -.gcolor blue - if (obsemi > 0) then {line from cx,cbsemi to ox,obsemi} -.gcolor -.gcolor green - if (obuncache > 0) then {line from cx,cbuncache to ox,obuncache} -.gcolor - - obram = cbram - obcache = cbcache - obfifo = cbfifo - obsemi = cbsemi - obuncache = cbuncache ox = cx - - # ram cached fifo semi uncached -.gcolor red - bullet at cx,cbram -.gcolor - bullet at cx,cbcache -.gcolor pink - bullet at cx,cbfifo -.gcolor -.gcolor blue - bullet at cx,cbsemi -.gcolor -.gcolor green - bullet at cx,cbuncache -.gcolor X .G2 diff --git a/paper/graph_query_tag.grap b/paper/graph_query_tag.grap index fb38bc0..77b8d03 100644 --- a/paper/graph_query_tag.grap +++ b/paper/graph_query_tag.grap @@ -23,53 +23,18 @@ copy "../data/tags.d" thru X y_scale = 1000000 - # ram cached fifo semi uncached - line from cx,$2/y_scale to cx,$4/y_scale - line from cx,$5/y_scale to cx,$7/y_scale - line from cx,$8/y_scale to cx,$10/y_scale - line from cx,$11/y_scale to cx,$13/y_scale - line from cx,$14/y_scale to cx,$16/y_scale + #line_no_mustache(cbram, obram, $3, red) + #line_no_mustache(cbcache, obcache, $6, black) + #line_no_mustache(cbfifo, obfifo, $9, pink) + #line_no_mustache(cbsemi, obsemi, $12, blue) + #line_no_mustache(cbuncache, obuncache, $15, green) - #ty = $3 + line_with_mustache(cbram, obram, $3, red, $2, $4) + line_with_mustache(cbcache, obcache, $6, black, $5, $7) + line_with_mustache(cbfifo, obfifo, $9, pink, $8, $10) + line_with_mustache(cbsemi, obsemi, $12,blue, $11, $13) + line_with_mustache(cbuncache,obuncache,$15,green, $14, $16) - cbram = $3/y_scale - cbcache = $6/y_scale - cbfifo = $9/y_scale - cbsemi = $12/y_scale - cbuncache = $15/y_scale - - if (obram > 0) then {line from cx,cbram to ox,obram} - if (obcache > 0) then {line from cx,cbcache to ox,obcache} -.gcolor pink - if (obfifo > 0) then {line from cx,cbfifo to ox,obfifo} -.gcolor -.gcolor blue - if (obsemi > 0) then {line from cx,cbsemi to ox,obsemi} -.gcolor -.gcolor green - if (obuncache > 0) then {line from cx,cbuncache to ox,obuncache} -.gcolor - - obram = cbram - obcache = cbcache - obfifo = cbfifo - obsemi = cbsemi - obuncache = cbuncache ox = cx - - # ram cached fifo semi uncached -.gcolor red - bullet at cx,cbram -.gcolor - bullet at cx,cbcache -.gcolor pink - bullet at cx,cbfifo -.gcolor -.gcolor blue - bullet at cx,cbsemi -.gcolor -.gcolor green - bullet at cx,cbuncache -.gcolor X .G2 diff --git a/paper/legend.grap b/paper/legend.grap index 33ab683..8ec53ed 100644 --- a/paper/legend.grap +++ b/paper/legend.grap @@ -10,6 +10,18 @@ define boite { line from xright,yup to xright,ydown } +define legend_line { + cy = $1 + lstartx = $2 + lendx = $3 + tstartx = $4 + +.gcolor $5 + line from lstartx,cy to lendx,cy +.gcolor + $6 ljust at tstartx,cy +} + define legend { xleft = $1 xright = $2 @@ -28,28 +40,15 @@ define legend { tstartx = lendx + diffx/20 .ps -2 - .gcolor red - line from lstartx,cy to lendx,cy - .gcolor - "RAM only" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,red,"RAM only") cy = cy - hdiff - line from lstartx,cy to lendx,cy - "Cached db and index" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,black,"Cached db and index") cy = cy - hdiff - .gcolor pink - line from lstartx,cy to lendx,cy - .gcolor - "FIFO db and cached index" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,pink,"FIFO db and cached index") cy = cy - hdiff - .gcolor blue - line from lstartx,cy to lendx,cy - .gcolor - "Uncached db, cached index" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,blue,"Uncached db, cached index") cy = cy - hdiff - .gcolor green - line from lstartx,cy to lendx,cy - .gcolor - "Uncached db and index" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,green,"Uncached db and index") .ps +2 } @@ -71,23 +70,13 @@ define legend_common { tstartx = lendx + diffx/20 .ps -2 -.gcolor red - line from lstartx,cy to lendx,cy -.gcolor - "1k" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,red,"1k") cy = cy - hdiff -.gcolor green - line from lstartx,cy to lendx,cy -.gcolor - "5k" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,green,"5k") cy = cy - hdiff - line from lstartx,cy to lendx,cy - "10k" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,black,"10k") cy = cy - hdiff -.gcolor pink - line from lstartx,cy to lendx,cy -.gcolor - "20k" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,pink,"20k") .ps +2 } @@ -110,14 +99,36 @@ define legend_fifo_addition { .ps -2 cy = cy - hdiff - .gcolor orange - line from lstartx,cy to lendx,cy - .gcolor - "basic FIFO" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,orange,"Basic FIFO") cy = cy - hdiff - .gcolor green - line from lstartx,cy to lendx,cy - .gcolor - "Efficient FIFO" ljust at tstartx,cy + legend_line(cy,lstartx,lendx,tstartx,green,"Efficient FIFO") .ps +2 } + +# WARNING: this macro uses "cx" (current x), y_scale and "ox" (old x). +define line_no_mustache { + # $1 = cbram + # $2 = obram + # $3 = column + # $4 = color + + $1 = $3/y_scale +.gcolor $4 + if ($2 > 0) then {line from cx,$1 to ox,$2} + bullet at cx,$1 +.gcolor + $2 = $1 +} + +# WARNING: this macro uses "cx" (current x), y_scale and "ox" (old x). +define line_with_mustache { + # $1 = cbram + # $2 = obram + # $3 = column + # $4 = color + # $5 = column mustache 1 + # $6 = column mustache 2 + + line_no_mustache($1,$2,$3,$4) + line from cx,$5/y_scale to cx,$6/y_scale +} diff --git a/paper/paper.ms b/paper/paper.ms index f3a93bc..3825bf1 100644 --- a/paper/paper.ms +++ b/paper/paper.ms @@ -943,7 +943,7 @@ The experiment starts with a database containing 1,000 cars and goes up to 250,0 .so graph_query_index.grap .ps \n[PS] .QP -This first figure shows the request durations to retrieve data based on a basic index with a database containing up to 250k entries. +This figure shows the request durations to retrieve data based on a basic index with a database containing up to 250k entries. .QE Since there is only one value to retrieve, the request is quick and time is almost constant. @@ -1059,7 +1059,7 @@ The following figures show the performance of the common database depending on t .so graph_fifo_query_index.grap .ps \n[PS] .QP -This first figure shows the request durations to retrieve data based on a basic index with a database containing up to 250k entries. +This figure shows the request durations to retrieve data based on a basic index with a database containing up to 250k entries. .QE .EQ delim $$ @@ -1077,7 +1077,7 @@ delim off .so graph_fifo_query_partition.grap .ps \n[PS] .QP -This first figure shows the request durations to retrieve data based on a partition containing up to 10k entries. +This figure shows the request durations to retrieve data based on a partition containing up to 10k entries. .QE As we see in the figure, the duration for data retrieval grows almost linearly for databases with a sufficient cache size (starting with 10k entries). When the cache size is not sufficient, the requests are hundred times slower, which explain why the database with a cache size of one thousand entries isn't even represented in the graph, and why the 5k database has great results up to 5k partitions. @@ -1085,5 +1085,6 @@ When the cache size is not sufficient, the requests are hundred times slower, wh .so graph_fifo_query_tag.grap .ps \n[PS] .QP -This first figure shows the request durations to retrieve data based on a tag containing up to 5k entries. +This figure shows the request durations to retrieve data based on a tag containing up to 5k entries. .QE +As for partitions, the response time depends on the number of entries to retrieve and the duration increases linearly with the number of elements.