The IronRuby team is pleased to announce a new release of IronRuby: IronRuby 0.6!
Staying true to our "Conference-driven development schedule," this release is in conjunction with ... wait, there is no conference this time! Just a good ol' monthly release of IronRuby, chock full of awesomeness. And just so happens to be the 4th of July weekend, so hopefully you have some downtime this weekend and can give the new release a spin.
What's in the Release?
Performance has been a major focus to this release, getting startup time quicker and optimizing built-in types. There has been more progress with Ruby compatibility (Cucumber works!) and .NET interop. Silverlight binaries are back in the release, and there are a couple of samples to help you learn IronRuby.
Most of these descriptions are from Tomas's very detailed code review emails, so thanks Tomas! For more detailed information, please see the CHANGELOG (which includes all commit messages for the release ... not just "syncing to head of tfs")
- Lazy method compilation
- CLR member enumeration
- Generic-Method Parameter-Inference
- Testing C# with Cucumber
- Silverlight building and updated binaries
Last release adaptive compilation was enabled for IronRuby, which uses a fast-to-start-up interpreter to start up the program, while code which gets run a lot is compiling on a background thread. This gave IronRuby significant performance improvements for large apps like Rails, which has improved startup by 2.5 times.
This release we've added "lazy method transformation" to the bag of startup performance tricks. In IronRuby 0.5, a method was transformed to the DLR AST as soon as it was defined. IronRuby 0.6 postpones the transformation until the first time the method is called. This significantly improves startup time. For example (not NGEN'd):
This has made Rails startup time 30% faster, coming in approximately 20 seconds on my dual-core laptop running Windows 7.
Now methods like
Module#instance_methods, etc, include CLR member names. Though it's a lot cooler than that. The array of methods returns contains strings for Ruby methods, and objects of type
IronRuby::Clr::Name to represent CLR methods that can be called by either the actual CLR name or a mangled (Ruby-esk) name. ClrName has methods
dump so that it can be used wherever a string can be used. The display string for the name uses single quotes so that you can easily distinguish CLR (dual) names from regular names (plain mutable strings). CLR strings display themselves as single quoted strings, so this fits nicely.
Even cooler, this works well for meta-programming:
A new set of define_method overloads, strongly typed to
ClrName, have been added to enable this. They define the real method using the
ruby_name and alias it using the
clr_name. So both
compare_to calls are intercepted.
Thanks to some work by the IronPython team, IronRuby now has parameter inference for generic methods.
This needs some more TLC before it works perfectly, but this lets you use simple LINQ methods from IronRuby.
This release of IronRuby runs the Cucumber testing framework rather well. Try out Cucumber against some C# code.
Given a feature file (this being the addition.feature)
A step_definition file (calculator_steps.rb)
And a DLL:
Cucumber will test the addition feature:
3 scenarios (3 passed) 12 steps (12 passed) 0m0.753s
This release re-adds Silverlight binaries to IronRuby, contained in the "silverlight" directory of the release. These bits have been integrated from the AgDLR project, and will be maintained in the IronRuby and IronPython source code repositories from now on. The AgDLR GitHub project will redirect to one of those for binaries for both languages in Silverlight. In addition, the SDLSDK CodePlex site will be redirecting to the IronRuby and IronPython CodePlex sites, for downloads, discussion, and issue tracking. AgDLR was a little side project to add new features to DLR Silverlight applications, and play around with Git. I'm very happy to see it merged back in with the languages.
Note: IronPython Silverlight assemblies are included directly in the release. They may be moved out to the separate package that contains IronPython desktop DLLs in the future.
Another notable change is that you can now build Silverlight binaries out of IronRuby's GitHub repository very easily. Given that you have Silverlight installed at
C:\Program Files\Microsoft Silverlight\2.0.40115.0, this will build IronRuby for Silverlight:
msbuild Merlin/Main/Languages/Ruby/Ruby.sln /p:Configuration="Silverlight Release /p:SilverlightPath="C:\Program Files\Microsoft Silverlight\2.0.40115.0
You can also build IronPython for Silverlight in a similar manner. Aliases for this will be added soon, but if you need a custom build of the DLR languages for Silverlight, this is the way to do it.
Six samples are included in this release. The first three are desktop samples in the “/samples” directory. The last three are Silverlight samples in the “/silverlight/samples” directory:
Some more interesting changes:
- Improved DLR Interop: adds support for GetMember/SetMember with method_missing, Binary/Unary operators, and indexers.
- Handling of CLR protected and private methods and properties
- Reimplemented File.expand_path such that it does not use System.IO.Path.
- This allows us to get better compatibility with MRI. The motivating reason was
- that RSpec does File.expand_path("filename:linenumber")
- Improves the implementation of singleton method dispatch.
- These changes improve running time of specs significantly (2x)
- Renames Method, UnboundMethod#overloads (plural) to
- Method, UnboundMethod#overload (singular).
- The old name is still available for now and throws an exception.
- Implements adaptively compiled rules
- Improves performance of Array#- from quadratic algorithm to linear.
- Improves implementation of RubyArray
Here are all 37 bugs closed since the last release (2009-05-19). You can see more information about each one on CodePlex.
1521 Access is allowed to internal fields 1502 alias_method fails for :do 821 File.expand_path does not support a line number after filename 1509 Proc.to_s should include line number where the block was declared 1501 WinForms broken 1400 $? is not always Process::Status 1345 load_assembly(
) should work 1344 System.Action.new does not work 1306 Cannot call CLR constructor of builtin type 1184 public(:foo) does not work correctly for mixed-in methods 1085 Cannot call new on subtypes of builtin classes whose "new" method has optional arguments 1060 visibility of send :define_method 917 Passing a Ruby array to a .NET method that expects an IEnumerable derivative fails with GetEnumerator call 783 Assert in SetMethodBasesNoLock when calling #== on Ruby class inheriting from CLR class which overrides Equals 761 Wrong behavior when calling redefined methods on object instances 1470 Can't call the BigIntegerOverload of a method with a DefaultProtocol Attribute on the BigInteger attribute 1426 The located assembly's manifest definition does not match the assembly reference. (ctp dev10 beta1) 1441 Error with cyrillyc text in Sharepoint 1352 Test Defects 814 Allocator underfined for (TypeError) 572 Error when running Cucumber examples with IronRuby 718 IronRuby ignores RUBYLIB environment variable 727 to_proc not working 1351 redist-libs should have rubygems-1.3.1 466 ''.split(//, -1) returns [""] instead of  940 Can't inherit from abstract classes 1028 Missing conversion from Duration to Fixnum (ActiveSupport)? 374 irails Foo: undefined method for OpenSLL::Random.random_bytes 459 throw FileNotFoundException => rescue Errno.NoEntryError 499 Pathname#cleanpath messes up the pathname 467 "igem install rails" fails 375 "ir script\server" causes a YAML parser error 461 Generic type conversion from Fixnum to Integer 674 autoload does not use File::SEPARATOR 1021 Time class instance 578 yield fails in eval'd code 605 Array#hash should properly handle recursive arrays
Please test out IronRuby 0.6 and let us know if you have any issues. We hope you enjoy this release!
-- The IronRuby team