فهرست منبع

Update benchmarking scripts

I don't remember what this did, but it was not commited
Hugo Musso Gualandi 4 سال پیش
والد
کامیت
8dd3c8ca35
2فایلهای تغییر یافته به همراه53 افزوده شده و 18 حذف شده
  1. 31 8
      scripts/bench-parse-perf.lua
  2. 22 10
      statistics/plot.r

+ 31 - 8
scripts/bench-parse-perf.lua

@@ -10,6 +10,15 @@ local pretty_names = {
     spectralnorm = "Spectral Norm",
     spectralnorm = "Spectral Norm",
 }
 }
 
 
+local function parse_name(module)
+    local code, is_aot = string.match(module, "^(.*)(_cor)$")
+    if is_aot then
+        return code, "aot"
+    else
+        return module, "lua"
+    end
+end
+
 local function pretty_name(module)
 local function pretty_name(module)
     local code, aot = string.match(module, "^(.*)(_cor)$")
     local code, aot = string.match(module, "^(.*)(_cor)$")
     local name = assert(pretty_names[code or module])
     local name = assert(pretty_names[code or module])
@@ -20,6 +29,7 @@ local function pretty_name(module)
     end
     end
 end
 end
 
 
+local rows = {}
 while true do
 while true do
     local blank = io.read("l");
     local blank = io.read("l");
     if not blank then break end
     if not blank then break end
@@ -36,13 +46,26 @@ while true do
     local ipc    = assert(string.match(lines[8], "(%S+) *insn per cycle"))
     local ipc    = assert(string.match(lines[8], "(%S+) *insn per cycle"))
     local time   = assert(string.match(lines[12], "(%S+) *seconds time elapsed"))
     local time   = assert(string.match(lines[12], "(%S+) *seconds time elapsed"))
 
 
-    local bench = pretty_name(module)
-    cycle = tonumber(cycle)
-    instr = tonumber(instr)
-    ipc   = tonumber(ipc)
-    time  = tonumber(time)
+    local r = {}
+    r.code, r.is_aot = parse_name(module)
+    r.cycle = tonumber(cycle)
+    r.instr = tonumber(instr)
+    r.ipc   = tonumber(ipc)
+    r.time  = tonumber(time)
+
+    table.insert(rows, r)
+end
+
+for i = 1, #rows, 2 do
+    local lua = rows[i]
+    local aot = rows[i+1]
+
+    assert(lua.code == aot.code)
+    assert(lua.is_aot == "lua")
+    assert(aot.is_aot == "aot")
 
 
-    local sinstr = string.format("$%6.2f\\times10^9$", instr/1.0e9)
-    local scycle = string.format("$%6.2f\\times10^9$", cycle/1.0e9)
-    print(string.format("%-20s & %6.2f & %18s & %18s & %4.2f \\\\", bench, time, sinstr, scycle, ipc))
+    local name = pretty_names[lua.code]
+    local instr = (aot.instr / lua.instr) * 100.0
+    local cycle = (aot.cycle / lua.cycle) * 100.0
+    print(string.format("%-14s & %3.1f & %3.1f \\\\", name, instr, cycle))
 end
 end

+ 22 - 10
statistics/plot.r

@@ -12,6 +12,7 @@ bench_codes <- c(
   "nbody",
   "nbody",
   "spectralnorm"
   "spectralnorm"
 )
 )
+
 bench_names <- c(
 bench_names <- c(
   "Binary Trees",
   "Binary Trees",
   "Fannkuch",
   "Fannkuch",
@@ -24,7 +25,7 @@ bench_names <- c(
 
 
 impl_codes <- c("lsw","lua","trm", "cor", "aot","jof", "jit")
 impl_codes <- c("lsw","lua","trm", "cor", "aot","jof", "jit")
 impl_used <- c("lua", "trm", "cor", "jit")
 impl_used <- c("lua", "trm", "cor", "jit")
-impl_names <- c("Lua","LuaAOT (Trampoline)", "LuaAOT (Goto)","LuaJIT")
+impl_names <- c("Lua", "Trampoline", "LuaAOT","LuaJIT")
 
 
 data <- read_csv("times-slow.csv", col_types = cols(
 data <- read_csv("times-slow.csv", col_types = cols(
     Benchmark = col_factor(bench_codes),
     Benchmark = col_factor(bench_codes),
@@ -33,16 +34,15 @@ data <- read_csv("times-slow.csv", col_types = cols(
     Time = col_double()
     Time = col_double()
 ))
 ))
 
 
-#data <- filter(data, Implementation %in% c("lsw","lua","trm","cor","aot","jof","jit"))
-data <- filter(data, Implementation %in% impl_used)
+plot_data <- filter(data, Implementation %in% impl_used)
 
 
 aggr_data <- data %>%
 aggr_data <- data %>%
-  group_by(Benchmark, Implementation) %>%
+  group_by(Benchmark,Implementation) %>%
   summarize(
   summarize(
     meanTime=mean(Time),
     meanTime=mean(Time),
     d=max(max(Time)-meanTime, meanTime-min(Time)))
     d=max(max(Time)-meanTime, meanTime-min(Time)))
 
 
-# mean_times <- data %>%
+mean_times <- plot_data %>%
     group_by(Benchmark,Implementation) %>%
     group_by(Benchmark,Implementation) %>%
     summarize(Time=mean(Time)) %>%
     summarize(Time=mean(Time)) %>%
     ungroup()
     ungroup()
@@ -51,7 +51,7 @@ mean_times_lua <- mean_times %>%
       filter(Implementation=="lua") %>%
       filter(Implementation=="lua") %>%
       select(Benchmark, LuaTime=Time)
       select(Benchmark, LuaTime=Time)
 
 
-normal_times <- data %>%
+normal_times <- plot_data %>%
     inner_join(mean_times_lua, by=c("Benchmark")) %>%
     inner_join(mean_times_lua, by=c("Benchmark")) %>%
     mutate(Time=Time/LuaTime) %>%
     mutate(Time=Time/LuaTime) %>%
     group_by(Benchmark,Implementation) %>%
     group_by(Benchmark,Implementation) %>%
@@ -63,7 +63,6 @@ normal_times <- data %>%
     ungroup()
     ungroup()
     
     
 dodge <- position_dodge(0.9)
 dodge <- position_dodge(0.9)
-    
 ggplot(normal_times,
 ggplot(normal_times,
        aes(x=Benchmark,y=mean_time,fill=Implementation)) +
        aes(x=Benchmark,y=mean_time,fill=Implementation)) +
   geom_col(position=dodge) +
   geom_col(position=dodge) +
@@ -73,6 +72,19 @@ ggplot(normal_times,
   scale_fill_discrete(labels=impl_names) +
   scale_fill_discrete(labels=impl_names) +
   scale_x_discrete(labels=bench_names) +
   scale_x_discrete(labels=bench_names) +
   scale_y_continuous(limits=c(0.0, 1.2), breaks=seq(from=0.0,to=1.2,by=0.25) ) +
   scale_y_continuous(limits=c(0.0, 1.2), breaks=seq(from=0.0,to=1.2,by=0.25) ) +
-  theme(
-    legend.position = "top",
-    axis.text.x=element_text(angle=30, hjust=1))
+  theme(axis.text.x=element_text(angle=30, hjust=1), legend.position = "top",)
+
+##########
+
+trm_times <- data %>%
+  filter(Implementation %in% c("trm", "cor")) %>%
+  group_by(Benchmark,Implementation) %>%
+  summarize(Time=mean(Time)) %>%
+  ungroup()
+
+trm_ratio <- inner_join(
+  filter(trm_times, Implementation=="trm"),
+  filter(trm_times, Implementation=="cor"),
+  by=c("Benchmark")) %>%
+mutate(Ratio=100.0*Time.x/Time.y) %>%
+select(Benchmark, Ratio)