by Genbox · 4y ago · 0 comments
I'm pretty sure you already know of sharplab.io. A lot of us C# devs prefer it over Compiler Explorer for a bunch of reasons, but the main one is really the speed.
My guess is that Sharplab gets it speed because it hooks directly into the JIT compiler itself. There is no overhead from touching disk or the linker.
If you're talking about the speed of other languages than C#, then most of the time is in the compilers itself, not the fairly limited pre- and post-processing we do. We have a pretty sophisticated setup (at least, I think it is...) for handling the 1,500 compiler/language combinations, hundreds of libraries etc (around 2TB of data), but there's always tradeoffs between fast start-up time, manageability and simplicity of adding new compilers, and the run-time performance of running the compilers etc.
.NET 7 will be officially released in a month or so.
Currently C#/F#/VB support in Compiler Explorer relies on prejitting which has various issues.
Edit: Oh wow I didn't realize the website does other languages, thanks!
$ curl -sL https://godbolt.org/api/languages
Id | Name
csharp | C#
fsharp | F#
vb | Visual Basic
go | Go
c | C
c++ | C++
fortran | Fortran
assembly | Assembly
circle | C++ (Circle)
circt | CIRCT
hlsl | HLSL
cppx | Cppx
crystal | Crystal
dart | Dart
erlang | Erlang
carbon | Carbon
hook | Hook
cppx_blue | Cppx-Blue
cppx_gold | Cppx-Gold
mlir | MLIR
cuda | CUDA C++
analysis | Analysis
python | Python
racket | Racket
ruby | Ruby
typescript | TypeScript Native
d | D
ada | Ada
cpp_for_opencl | C++ for OpenCL
openclc | OpenCL C
llvm | LLVM IR
cpp2_cppfront | Cpp2-cppfront
rust | Rust
ispc | ispc
java | Java
kotlin | Kotlin
nim | Nim
pony | Pony
scala | Scala
solidity | Solidity
clean | Clean
pascal | Pascal
haskell | Haskell
ocaml | OCaml
swift | Swift
zig | Zig
$ CL-USER> (defun do-something (a b)
(format t "a: ~a~%b: ~a~%~%" a b))
DO-SOMETHING
CL-USER> (disassemble #'do-something)
; disassembly for DO-SOMETHING
; Size: 216 bytes. Origin: #x537D0F66 ; DO-SOMETHING
; 0F66: 498B4510 MOV RAX, [R13+16] ; thread.binding-stack-pointer
; 0F6A: 488945F8 MOV [RBP-8], RAX
; 0F6E: 840425F87F0050 TEST AL, [#x50007FF8] ; safepoint
; 0F75: 498BB5E8050000 MOV RSI, [R13+1512] ; tls: *STANDARD-OUTPUT*
; 0F7C: 4883FEFF CMP RSI, -1
; 0F80: 480F443425B05B1450 CMOVEQ RSI, [#x50145BB0] ; *STANDARD-OUTPUT*
; 0F89: 488975E0 MOV [RBP-32], RSI
; 0F8D: 4883EC10 SUB RSP, 16
; 0F91: 488B1570FFFFFF MOV RDX, [RIP-144] ; "a: "
; 0F98: 488B7DE0 MOV RDI, [RBP-32]
; ...
And of course it works for the functions that are defined by the standard, too: CL-USER> (disassemble #'format)
; disassembly for FORMAT
; Size: 581 bytes. Origin: #x52A12CCD ; FORMAT
; CCD: 840425F87F0050 TEST AL, [#x50007FF8] ; safepoint
; CD4: 48817DF817810050 CMP QWORD PTR [RBP-8], #x50008117 ; NIL
; CDC: 0F85CB000000 JNE L4
; CE2: 4881EC90000000 SUB RSP, 144
; CE9: 4883E4F0 AND RSP, -16
; CED: 488D7C240F LEA RDI, [RSP+15]
; CF2: 48C747F1E5000000 MOV QWORD PTR [RDI-15], 229
; CFA: 48C747F93E000000 MOV QWORD PTR [RDI-7], 62
; D02: 4881ECB0000000 SUB RSP, 176
; D09: 4883E4F0 AND RSP, -16
; D0D: 488BC4 MOV RAX, RSP
; ...
CL-USER> (disassemble #'first)
CL-USER> (disassemble #'+)Maybe there is a way to plug hsdis into the workflow.
EDIT: Actually there is already a ticket discussing this, https://github.com/compiler-explorer/compiler-explorer/issue...