dmd -run speed trends

Siarhei Siamashka siarhei.siamashka at gmail.com
Thu Dec 7 21:48:29 UTC 2023


On Thursday, 7 December 2023 at 20:39:03 UTC, Witold Baryluk 
wrote:
> Also for completeness, golang:
> [...]

For completeness, could you please also try Ruby interpreter and 
Crystal compiler? The same source file is valid for both. The 
wacky default constructor arguments are there to provide hints 
for the Crystal's type inference. This may bring some optimism 
here, because Crystal has a rather slow compiler. Kotlin is slow 
too.

```Ruby
#!/usr/bin/env ruby

require "set"

class Person
   def initialize(name = "?", age = -1)
     @name = name
     @age = age
   end
   def name
     @name
   end
   def age
     @age
   end
end

people = [
   Person.new("John", 45),
   Person.new("Kate", 30),
]

people.each do |person|
   puts "#{person.name} is #{person.age} years old"
end

def oddNumbers(a)
   a.each {|x| yield x if x % 2 == 1 }
end

oddNumbers([3, 6, 9, 12, 15, 18]) do |odd|
   puts odd
end

def toLookupTable(data)
   return data.split(';').to_set
end

data = "mov;btc;cli;xor;afoo"
opcodes = toLookupTable(data)

opcodes.each {|o| puts o }
```



More information about the Digitalmars-d mailing list