RubyAMF – Skipping 1.3.4 And Writing 1.3.5

Surprise! RubyAMF 1.3.5 is under way, and no 1.3.4 will be released.

So here’s the scoop. Aryk Grosz from MixBook contacted me about using RubyAMF and some experiences he was having. RubyAMF would start to slow down with large complex data structures even slower than WebORB depending on the size, Yikes! Aryk had put time into optimizing RubyAMF and you would not believe the results we’re getting.

I went down to Mixbook in San Jose on Sunday and spent a little time with Aryk ripping apart RubyAMF. So we’ve pretty much re-written RubyAMF, here’s a brief rundown of what’s going on.

First let’s talk restructure. We ripped out 60% of the code base which was legacy from RAMFL. I won’t go into the gory details but we’ve re-arranged a lot, changed a lot of names. For example ValueObjects are now ClassMappings. Which is more appropriate because RAMF has full class mapping support. We’ve also put an init.rb file in the plugin so all the requires get done on application startup.

There are a couple other features we’ve added to class mapping definitions, such as the :associations, :attributes, and :ignore_fields properties. The :ignore_fields is just like it sounds, for a specific class mapping you can ignore specific properties on it. You can also define a global ignore fields like so: ClassMappings.ignore_fields.

The :associations and :attributes are for performance reasons. You aren’t required to use them, but if you do it speeds up the serializer even more. We’ve also change the names of :incoming / :map_to / :o utgoing to :actionscript / :ruby.

Performance! This thing is about 5x faster. As an example, a data structure of about 1500 objects that’s used in Mixbook takes around 35 seconds with WebORB. RAMF averages 2.4 seconds. Sweet! You can even see the speed increase on one object. It’s that much faster.

We also decreased the size of the data transfer. As an example, let’s say an AMF message was 250K, it would now be about 100K. That’s a huge difference.

That’s just a small preview of what’s going on. Sorry for the inconvenience of not getting 1.3.4 done last week, but as soon as we started these changes and optimizations – 1.3.4 was obsolete.

So hats off to Aryk for the help, he did a most of the speed optimizations and has been refactoring and writing a ton for RubyAMF. Thanks for the help!

And to top it all off, RubyAMF will have it’s first “in production” customer over at MixBook. They’re working on re-factoring their rails app to use RubyAMF. Awesome!

-Aaron

aaron said,

October 23, 2007 @ 00:31

1.3.5 is in SVN at /branches/mixdev/rubyamf

There are a couple known issues with it, but if you try it and see any problems go ahead and put it into the issues on our google code page.

-Aaron

Bolo said,

October 23, 2007 @ 04:01

1.3.5 works with gems edge ?

anderson said,

October 23, 2007 @ 07:47

Hello, i downloaded the last version of RubyAMF that’s on RubyForge but i couldn’t fin rubyamf_controller.rb like in your screencast. I have to create this file?

thanks

aaron said,

October 23, 2007 @ 07:58

@anderson, you need to do a plugin install for rails.

ruby script/plugin install http://rubyamf.googlecode.com/svn/trunk/

That will set you up with rubyamf 1.3.4 which is considered stable. Or if you want 1.3.5 its here:

ruby script/plugin install http://rubyamf.googlecode.com/svn/branches/mixdev/rubyamf

-Aaron

aaron said,

October 23, 2007 @ 08:00

@bolo, sorry we haven’t gotten to rails 2 support yet. It’s very high on my list though.

Sonny said,

October 23, 2007 @ 11:50

I have a Flex app and I”m doing HTTPService calls.

I am trying 1.3.5 and I am getting this error:
RubyamfController: missing default helper path rubyamf_helper

I guess that file isn’t ready yet?

Thanks!

aaron said,

October 23, 2007 @ 11:54

OK arron, thanks :)

Andrew’s Thoughts From a Cave » Mixbook and RubyAMF said,

October 23, 2007 @ 12:01

[...] RubyAMF – Skipping 1.3.4 and Writing 1.3.5 [...]

aaron said,

October 23, 2007 @ 14:05

@sonny, the rubyamf helper shouldn’t be a fatal error, it’s just a warning. I get it too :) . You can create the file yourself and it will go away.

Paul Odeon said,

October 28, 2007 @ 05:50

Hi,

I just got started with RubyAMF on a new project, having switched over from WebORB.

One thing I noticed is the lack of support for namespaced controllers which I needed for this project. I managed to hack a solution by using a modified get_const function that supports the :: syntax, see http://redcorundum.blogspot.com/2006_05_01_archive.html

If you’re interested in including this as a feature in RubyAMF let me know and I’ll send the details over.

Big thanks for releasing RubyAMF btw!

Paul

Paul Odeon said,

November 1, 2007 @ 08:52

Also in rubyamf_core/util/object.rb line 14, shouldnt it be:

members = self.instance_variables.map{|mem| mem[1,mem.length]}

it threw up an error for me at one point saying property obj does not exist

aaron said,

November 4, 2007 @ 10:04

@Paul, with 1.5 that “object” file is taken out, and there is namespace support.

Paul Odeon said,

November 5, 2007 @ 14:32

Great stuff!

Vixiom Axioms » Two new ways to load data into Flash said,

December 4, 2007 @ 22:26

[...] but I wouldn’t doubt it’s the fastest as many other methods aren’t too speedy (Although RubyAMF is much quicker [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment