Παρασκευή, 25 Σεπτεμβρίου 2015

Benchmark M2000 - Μέτρηση ταχύτητας

Παραθέτω το πρόγραμμα στα αγγλικά (σε άλλη ανάρτηση θα φτιάξω το ελληνικό, αν και θα είναι πιο αργό επειδή ο μεταφραστής βγάζει τους τόνους πρώτα)
Εκκίνηση της γλώσσας (m2000.exe), σ α και επικόλληση, βγαίνουμε με Esc και γράφουμε α και παίρνουμε μια λίστα τιμών στην οθόνη όπως αυτή παρακάτω:

module b {
      function x {=1000}
      a=x()
}
module alfabetagama {
      function abignametoo {=1000}
      alfabeta=abignametoo()
}
module alfabetaDot {
      function abignametoo {=1000}
      alfabeta=.abignametoo()
}
module alfa_beta_gama {
      function a_big_name_too {=1000}
      alfa_beta=a_big_name_too()
}
Function Pr$ {
      read a
      if a=1 then {="optimization on"} else ="optimization off"
}
Form 80,40
Cls 1, 0 : Pen 14
Print $(4),   \\ Proportional Printing
for k=1 to 2 {
      if k=1 then {optimization on } else optimization off
      Print Pr$(k)
      Print "Normal Names"
      local alfabeta,betagama,deltaepsilon
      betagama=2
      deltaepsilon=45
      Profiler
      for i=1 to 3000
            alfabeta=sqrt(betagama)+sin(deltaepsilon)
            alfabetagama
      next i
      Print TimeCount
      refresh
      Print "Names with _"
      local alfa_beta,beta_gama,delta_epsilon
      beta_gama=2
      delta_epsilon=45
      Profiler
      for i=1 to 3000
            alfa_beta=sqrt(beta_gama)+sin(delta_epsilon)
            alfa_beta_gama
      next i
      Print TimeCount
      refresh
      Print "Names with one lettter"
      local a, b, d
      b=2
      d=45
      Profiler
      for i=1 to 3000
            a=sqrt(b)+sin(.d)
            b
      next i
      Print TimeCount
      refresh
      Print "Full Names with dot infront and @ in system functions"
      local alfabeta,betagama,deltaepsilon
      betagama=2
      deltaepsilon=45
      Profiler
      for i=1 to 3000
            .alfabeta=@sqrt(.beta_gama)+@sin(.delta_epsilon)
            .alfabetaDot
      next i
      Print TimeCount
      refresh
}
Print  "Using fast For {}"
Refresh
for k=1 to 2 {
      if k=1 then {optimization on } else optimization off
      Print Pr$(k)
      Print "Normal Names"
      local alfabeta,betagama,deltaepsilon
      betagama=2
      deltaepsilon=45
      Profiler
      for i=1 to 3000 {
            alfabeta=sqrt(betagama)+sin(deltaepsilon)
            alfabetagama
      }
      Print TimeCount
      refresh
      Print "Names with _"
      local alfa_beta,beta_gama,delta_epsilon
      beta_gama=2
      delta_epsilon=45
      Profiler
      for i=1 to 3000 {
            alfa_beta=sqrt(beta_gama)+sin(delta_epsilon)
            alfa_beta_gama
      }
      Print TimeCount
      refresh
      Print "Names with one lettter"
      local a, b, d
      b=2
      d=45
      Profiler
      for i=1 to 3000 {
            a=sqrt(b)+sin(.d)
            b
      }
      Print TimeCount
      refresh
      Print "Full Names with dot infront and @ in system functions"
      local alfabeta,betagama,deltaepsilon
      betagama=2
      deltaepsilon=45
      Profiler
      for i=1 to 3000 {
            .alfabeta=@sqrt(.beta_gama)+@sin(.delta_epsilon)
            .alfabetaDot
      }
      Print TimeCount
      refresh
}




Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου