- 
                Notifications
    
You must be signed in to change notification settings  - Fork 17
 
Add .NET on WebAssembly workload #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 23 commits
      Commits
    
    
            Show all changes
          
          
            28 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      dd055ee
              
                Implement .NET benchmarks
              
              
                maraf c11b328
              
                Add JSON
              
              
                maraf ba05a96
              
                Deduplicate preloads
              
              
                maraf 8cba497
              
                Add JSON to in-depth.html
              
              
                maraf 7735bfe
              
                Combine all tests
              
              
                maraf 0f265ab
              
                Update in-depth.html
              
              
                maraf ba35bc3
              
                Reduce iterations
              
              
                maraf 1f9bc2b
              
                Further iteration reduction
              
              
                maraf b719e8f
              
                Make it work on cli without preloading
              
              
                maraf 8ce2c23
              
                Update to 9.0.7
              
              
                maraf 5623e4c
              
                Smaller scene size for interp
              
              
                maraf a22b110
              
                Merge remote-tracking branch 'upstream/main' into DotnetWasm
              
              
                maraf 79df4d0
              
                Use getBinary
              
              
                maraf 51d90cc
              
                Use getBinary
              
              
                maraf 1ed0ee3
              
                Remove WarmUp
              
              
                maraf 67cc1bd
              
                Smaller raytracer scene, more samples in bench tasks
              
              
                maraf 97f97f1
              
                hardwareConcurrency = 1
              
              
                maraf 186b1f7
              
                Emit symbols
              
              
                maraf d4d74ce
              
                Rebuild interp
              
              
                maraf 2bdb75c
              
                Mark core assemblies
              
              
                maraf dc750e9
              
                Monkey patch use of import.meta.url
              
              
                maraf ded3bbd
              
                .NET SDK info
              
              
                maraf b0353a6
              
                README
              
              
                maraf 37e1621
              
                Description of .NET build output
              
              
                maraf a1d0702
              
                chmod +x build.sh
              
              
                maraf 7a39202
              
                Exclude additional files from git
              
              
                maraf 295ae1a
              
                Prepend import.meta.url and copy symbols from obj
              
              
                maraf 5aa9dad
              
                Readme
              
              
                maraf File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| *.binlog | ||
| .dotnet | ||
| .nuget | ||
| bin | ||
| obj | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # .NET on WebAssembly | ||
| 
     | 
||
| Tests [.NET on WebAssembly](https://github.com/dotnet/runtime). This benchmark tests operations | ||
| on .NET implementation of String, JSON serialization, specifics of .NET exceptions and computation | ||
| of a 3D scene using Mono Interpreter & AOT. Source code: [.NET](wasm/dotnet) | ||
| 
     | 
||
| ## Build instructions | ||
| 
     | 
||
| Download .NET SDK 9.0.3xx | ||
| 
     | 
||
| - [dotnet-sdk-win-x64.zip](https://aka.ms/dotnet/9.0.3xx/daily/dotnet-sdk-win-x64.zip) | ||
| - [dotnet-sdk-linux-x64.tar.gz](https://aka.ms/dotnet/9.0.3xx/daily/dotnet-sdk-linux-x64.tar.gz) | ||
| 
     | 
||
| Run `build.sh` script. It will install `wasm-tools` workload & build the benchmark code twice (for Mono interpreter & AOT). | ||
| 
     | 
||
| To run the benchmark code on `jsc`, we need to remove the unguarded use of `import.meta.url` in `dotnet.js`. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| globalThis.dotnetFlavor = "aot"; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| class Benchmark { | ||
| async init() { | ||
| const config = { | ||
| mainAssemblyName: "dotnet.dll", | ||
| globalizationMode: "custom", | ||
| assets: [ | ||
| { | ||
| name: "dotnet.runtime.js", | ||
| resolvedUrl: dotnetRuntimeUrl, | ||
| moduleExports: await dynamicImport(dotnetRuntimeUrl), | ||
| behavior: "js-module-runtime" | ||
| }, | ||
| { | ||
| name: "dotnet.native.js", | ||
| resolvedUrl: dotnetNativeUrl, | ||
| moduleExports: await dynamicImport(dotnetNativeUrl), | ||
| behavior: "js-module-native" | ||
| }, | ||
| { | ||
| name: "dotnet.native.wasm", | ||
| resolvedUrl: wasmBinaryUrl, | ||
| buffer: await getBinary(wasmBinaryUrl), | ||
| behavior: "dotnetwasm" | ||
| }, | ||
| { | ||
| name: "icudt_CJK.dat", | ||
| resolvedUrl: icuCustomUrl, | ||
| buffer: await getBinary(icuCustomUrl), | ||
| behavior: "icu" | ||
| }, | ||
| { | ||
| name: "System.Collections.Concurrent.wasm", | ||
| resolvedUrl: dllCollectionsConcurrentUrl, | ||
| buffer: await getBinary(dllCollectionsConcurrentUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Collections.wasm", | ||
| resolvedUrl: dllCollectionsUrl, | ||
| buffer: await getBinary(dllCollectionsUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.ComponentModel.Primitives.wasm", | ||
| resolvedUrl: dllComponentModelPrimitivesUrl, | ||
| buffer: await getBinary(dllComponentModelPrimitivesUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.ComponentModel.TypeConverter.wasm", | ||
| resolvedUrl: dllComponentModelTypeConverterUrl, | ||
| buffer: await getBinary(dllComponentModelTypeConverterUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Drawing.Primitives.wasm", | ||
| resolvedUrl: dllDrawingPrimitivesUrl, | ||
| buffer: await getBinary(dllDrawingPrimitivesUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Drawing.wasm", | ||
| resolvedUrl: dllDrawingUrl, | ||
| buffer: await getBinary(dllDrawingUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.IO.Pipelines.wasm", | ||
| resolvedUrl: dllIOPipelinesUrl, | ||
| buffer: await getBinary(dllIOPipelinesUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Linq.wasm", | ||
| resolvedUrl: dllLinqUrl, | ||
| buffer: await getBinary(dllLinqUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Memory.wasm", | ||
| resolvedUrl: dllMemoryUrl, | ||
| buffer: await getBinary(dllMemoryUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.ObjectModel.wasm", | ||
| resolvedUrl: dllObjectModelUrl, | ||
| buffer: await getBinary(dllObjectModelUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Private.CoreLib.wasm", | ||
| resolvedUrl: dllPrivateCorelibUrl, | ||
| buffer: await getBinary(dllPrivateCorelibUrl), | ||
| behavior: "assembly", | ||
| isCore: true | ||
| }, | ||
| { | ||
| name: "System.Runtime.InteropServices.JavaScript.wasm", | ||
| resolvedUrl: dllRuntimeInteropServicesJavaScriptUrl, | ||
| buffer: await getBinary(dllRuntimeInteropServicesJavaScriptUrl), | ||
| behavior: "assembly", | ||
| isCore: true | ||
| }, | ||
| { | ||
| name: "System.Text.Encodings.Web.wasm", | ||
| resolvedUrl: dllTextEncodingsWebUrl, | ||
| buffer: await getBinary(dllTextEncodingsWebUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "System.Text.Json.wasm", | ||
| resolvedUrl: dllTextJsonUrl, | ||
| buffer: await getBinary(dllTextJsonUrl), | ||
| behavior: "assembly" | ||
| }, | ||
| { | ||
| name: "dotnet.wasm", | ||
| resolvedUrl: dllAppUrl, | ||
| buffer: await getBinary(dllAppUrl), | ||
| behavior: "assembly", | ||
| isCore: true | ||
| } | ||
| ] | ||
| }; | ||
| 
     | 
||
| this.dotnet = (await dynamicImport(dotnetUrl)).dotnet; | ||
| this.api = await this.dotnet.withModuleConfig({ locateFile: e => e }).withConfig(config).create(); | ||
                
      
                  maraf marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| this.exports = await this.api.getAssemblyExports("dotnet.dll"); | ||
| 
     | 
||
| this.hardwareConcurrency = 1; | ||
| this.sceneWidth = dotnetFlavor === "aot" ? 300 : 150; | ||
| this.sceneHeight = dotnetFlavor === "aot" ? 200 : 100; | ||
| } | ||
| async runIteration() { | ||
| await this.exports.Interop.RunIteration(this.sceneWidth, this.sceneHeight, this.hardwareConcurrency); | ||
| } | ||
| } | ||
        
          
          Binary file added
          
            BIN
              
                +14.8 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.Collections.Concurrent.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
        
          
          Binary file added
          
            BIN
              
                +5.77 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.ComponentModel.Primitives.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
        
          
          Binary file added
          
            BIN
              
                +5.27 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.ComponentModel.TypeConverter.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
        
          
          Binary file added
          
            BIN
              
                +20.3 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.Drawing.Primitives.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
        
          
          Binary file added
          
            BIN
              
                +38.3 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.Runtime.InteropServices.JavaScript.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
        
          
          Binary file added
          
            BIN
              
                +28.8 KB
              
          
        
  wasm/dotnet/build-aot/wwwroot/_framework/System.Text.Encodings.Web.wasm
  
  
      
      
   
        
      
      
    
            Binary file not shown.
          
    
            Binary file not shown.
          
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "mainAssemblyName": "dotnet", | ||
| "resources": { | ||
| "hash": "sha256-mdtA29iGB6XZvrWEaXl2AA+kfTtlB/jINgoyJI8V+N0=", | ||
| "jsModuleNative": { | ||
| "dotnet.native.js": "sha256-Ca6UeRnsgHRBtJNPbrErXmKImnD9qkhZV+u7XAPg7Kk=" | ||
| }, | ||
| "jsModuleRuntime": { | ||
| "dotnet.runtime.js": "sha256-x+PnWU47EIr/zL3xxqIUMDJi/dy5904TVGunDqCvjIY=" | ||
| }, | ||
| "wasmNative": { | ||
| "dotnet.native.wasm": "sha256-5IUs4xJpnq2JqkyYPdKn6ypYT3c+61nt1P1vvEPXo2g=" | ||
| }, | ||
| "icu": { | ||
| "icudt_CJK.dat": "sha256-SZLtQnRc0JkwqHab0VUVP7T3uBPSeYzxzDnpxPpUnHk=", | ||
| "icudt_EFIGS.dat": "sha256-8fItetYY8kQ0ww6oxwTLiT3oXlBwHKumbeP2pRF4yTc=", | ||
| "icudt_no_CJK.dat": "sha256-L7sV7NEYP37/Qr2FPCePo5cJqRgTXRwGHuwF5Q+0Nfs=" | ||
| }, | ||
| "coreAssembly": { | ||
| "dotnet.wasm": "sha256-L9ikR6noSArHMLSS5bEeP56holqZR9+98IHJDkIYQZA=", | ||
| "System.Collections.Concurrent.wasm": "sha256-t0RfwdTUubHqJjICCaVLtSx90sFWPoVRYIBQnpqEfMQ=", | ||
| "System.Collections.wasm": "sha256-74tIaxlz1VKy1ZJ4df4oWr0Qg+02hNMZMg8sM0uJR2s=", | ||
| "System.ComponentModel.Primitives.wasm": "sha256-9KlsDyYr/L+BwPCVQ2tA0tK0UoOCyGIHfd97P1s0oBE=", | ||
| "System.ComponentModel.TypeConverter.wasm": "sha256-H//PcPvC16VhrKNkarNofnzwn5WAo68J3Z340mRhrh4=", | ||
| "System.Drawing.Primitives.wasm": "sha256-bGcvJFPgMqxUOkp9q8/fhHawpRFta6Ar7ySsFIpZ9qk=", | ||
| "System.Drawing.wasm": "sha256-nb2jLiw4KDtlI4RomxyIiWcM/skfDq5jTLTqlJbXbwg=", | ||
| "System.IO.Pipelines.wasm": "sha256-LHmn3NZ0cYl/sD4s/EA26iSAYqDCycxgYdwt6suIKLM=", | ||
| "System.Linq.wasm": "sha256-eRQ2yKv3JP64KBRLvwtLwSlbppQjb762xQNooQGJHAE=", | ||
| "System.Memory.wasm": "sha256-r8Kxq0g7VCrnXJ56At7Do+nd5C+iMx+5hehlmndZ6rM=", | ||
| "System.ObjectModel.wasm": "sha256-3cKLFYajKINLJVByXBP5/Acx77qAT7PSgLMjEbwJT/Y=", | ||
| "System.Private.CoreLib.wasm": "sha256-VeHFDCz0ZLJHaMF1WXBO1dq32aqOtAxQBY7UtOYHFV4=", | ||
| "System.Runtime.InteropServices.JavaScript.wasm": "sha256-korzY+8y6mDCphxjpRx32qfUE1gK6/6D9W3cnrkRvjo=", | ||
| "System.Text.Encodings.Web.wasm": "sha256-FQmyjTLY+V+DwY398iWiXOOSDmS7cQtLg/Tc6hw2MGQ=", | ||
| "System.Text.Json.wasm": "sha256-DIIG/xiMdrqVxsRrAgOchWbwxu3ftjBvEwUqHNHpWgs=" | ||
| }, | ||
| "assembly": {} | ||
| }, | ||
| "cacheBootResources": true, | ||
| "debugLevel": 0, | ||
| "linkerEnabled": true, | ||
| "globalizationMode": "sharded" | ||
| } | 
Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.