WSL vs Native Linux Benchmarks

I read that WSL degrades crystal’s compiler speed by a lot. And also hinders it more with WSL IO issues.
I made this little Benchmark script and would love for everyone to post their results. I know it’s not the best benchmark in the world, but I just needed something to spike up the CPU.

If you are on WSL and have something different than a i7 2600, I would still love to see your results!

require "json"

AMOUNT = 2000000

JSON.parse(
  %({"web-app": {
        "servlet": [
          {
            "servlet-name": "cofaxCDS",
            "servlet-class": "org.cofax.cds.CDSServlet",
            "init-param": {
              "configGlossary:installationAt": "Philadelphia, PA",
              "configGlossary:adminEmail": "ksm@pobox.com",
              "configGlossary:poweredBy": "Cofax",
              "configGlossary:poweredByIcon": "/images/cofax.gif",
              "configGlossary:staticPath": "/content/static",
              "templateProcessorClass": "org.cofax.WysiwygTemplate",
              "templateLoaderClass": "org.cofax.FilesTemplateLoader",
              "templatePath": "templates",
              "templateOverridePath": "",
              "defaultListTemplate": "listTemplate.htm",
              "defaultFileTemplate": "articleTemplate.htm",
              "useJSP": false,
              "jspListTemplate": "listTemplate.jsp",
              "jspFileTemplate": "articleTemplate.jsp",
              "cachePackageTagsTrack": 200,
              "cachePackageTagsStore": 200,
              "cachePackageTagsRefresh": 60,
              "cacheTemplatesTrack": 100,
              "cacheTemplatesStore": 50,
              "cacheTemplatesRefresh": 15,
              "cachePagesTrack": 200,
              "cachePagesStore": 100,
              "cachePagesRefresh": 10,
              "cachePagesDirtyRead": 10,
              "searchEngineListTemplate": "forSearchEnginesList.htm",
              "searchEngineFileTemplate": "forSearchEngines.htm",
              "searchEngineRobotsDb": "WEB-INF/robots.db",
              "useDataStore": true,
              "dataStoreClass": "org.cofax.SqlDataStore",
              "redirectionClass": "org.cofax.SqlRedirection",
              "dataStoreName": "cofax",
              "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
              "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
              "dataStoreUser": "sa",
              "dataStorePassword": "dataStoreTestQuery",
              "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
              "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
              "dataStoreInitConns": 10,
              "dataStoreMaxConns": 100,
              "dataStoreConnUsageLimit": 100,
              "dataStoreLogLevel": "debug",
              "maxUrlLength": 500}},
          {
            "servlet-name": "cofaxEmail",
            "servlet-class": "org.cofax.cds.EmailServlet",
            "init-param": {
            "mailHost": "mail1",
            "mailHostOverride": "mail2"}},
          {
            "servlet-name": "cofaxAdmin",
            "servlet-class": "org.cofax.cds.AdminServlet"},

          {
            "servlet-name": "fileServlet",
            "servlet-class": "org.cofax.cds.FileServlet"},
          {
            "servlet-name": "cofaxTools",
            "servlet-class": "org.cofax.cms.CofaxToolsServlet",
            "init-param": {
              "templatePath": "toolstemplates/",
              "log": 1,
              "logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
              "logMaxSize": "",
              "dataLog": 1,
              "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
              "dataLogMaxSize": "",
              "removePageCache": "/content/admin/remove?cache=pages&id=",
              "removeTemplateCache": "/content/admin/remove?cache=templates&id=",
              "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
              "lookInContext": 1,
              "adminGroupID": 4,
              "betaServer": true}}],
        "servlet-mapping": {
          "cofaxCDS": "/",
          "cofaxEmail": "/cofaxutil/aemail/*",
          "cofaxAdmin": "/admin/*",
          "fileServlet": "/static/*",
          "cofaxTools": "/tools/*"},

        "taglib": {
          "taglib-uri": "cofax.tld",
          "taglib-location": "/WEB-INF/tlds/cofax.tld"}}})
)

class Turkey
  property test = Hash(String, Int32).new

  def initialize
    AMOUNT.times do |x|
      test["muffin#{x}"] = x
    end
    AMOUNT.times do |x|
      test.delete "muffin#{x}"
    end
  end
end

Turkey.new

What to do next:

  • Save this file as benchmark.cr
  • Now run time crystal benchmark.cr

Please add your operating system and system specs as well.
Please copy the template below and paste in your info! This way, I can easily track everyone’s results.

> **OS:** Windows 10, 64-bit WSL on Ubuntu 16.04.5 LTS
**CPU:** i7-2600 CPU @ 3.40GHz
**Output:**
real    0m6.285s
user    0m6.125s
sys     0m1.594s

I will go first:

OS: Windows 10, 64-bit WSL on Ubuntu 16.04.5 LTS
CPU: i7-2600 CPU @ 3.40GHz
Output:
real 0m6.285s
user 0m6.125s
sys 0m1.594s

Thank you!

OS: OpenSUSE Tumbleweed 20190115 (64-bit)
CPU: 8 x i5-8300H CPU @ 2.3GHz
Output:
real 0m1.269s
user 0m2.168s
sys 0m0.301s

With --release, same machine:

Output:
real 0m6.326s
user 0m6.323s
sys 0m0.114s

1 Like

OS: Debian testing (Buster)
CPU: i7-3520M CPU @ 2.90GHz
Output:

real 0m6.058s
user 0m6.808s
sys 0m0.379s

with --release
real 0m3.264s
user 0m3.968s
sys 0m0.266s

RaspberryPi
OS: raspbian Stretch
CPU: ARMv7 Processor rev 4 (v7l)
Output:

real 0m42.813s
user 0m49.750s
sys 0m1.210s

–release

real 0m46.240s
user 0m51.230s
sys 0m0.680s

1 Like

OS: macOS High Sierra (10.13.4)
CPU: i7-6820HQ CPU @ 2.70GHz
Output:
real 0m6.409s
user 0m6.76s
sys 0m0.87s

1 Like

OS: ARMBIAN 5.72.190118 nightly Debian GNU/Linux 9 (stretch) 4.19.13-sunxi64
CPU: Allwinner A64 1.2 Ghz Quad-Core ARM Cortex A53 64-Bit Processor.
Output:
real 0m19.102s
user 0m18.710s
sys 0m0.388s

1 Like

OS: Lubuntu 19.04 (Disco Dingo)
CPU: Intel(R) Core™ i7-6500U CPU @ 2.50GHz
Output:
scaling governor to performance
real 0m 2.55s
user 0m 3.48s
sys 0m 0.17s
scaling governor to powersave
real 0m 3.18s
user 0m 4.20s
sys 0m 0.23s

1 Like

OS: Arch Linux 4.20.3-arch1-1-ARCH
CPU: Ryzen 5 2400G @3.9 GHz
Output:
real 0m6.251s
user 0m7.13s
sys 0m0.36s

1 Like

OS: Debian 9, Linux 4.9.0-8-amd64
CPU: i7-7700k CPU @ 5GHz

Output:

Stat Time
real 0m1.434s
user 0m2.268s
sys 0m0.104s
1 Like

Sometimes turning off the “windows defender” helps with disk intensive ops. Not sure if this is one of those however…

14s i5 2500 3.3GHz WSL

1 Like

OS: Manjaro Linux 4.19.16-1-MANJARO
CPU: AMD FX-8320E @ 8 * 3.2 GHz
Output:
real 0m7,117s
user 0m9,140s
sys 0m0,831s

With --release:

Output:
real 0m10,186s
user 0m11,326s
sys 0m0,596s