[macruby-changes] [2581] MacRubyWebsite/trunk/content/blog

source_changes at macosforge.org source_changes at macosforge.org
Sat Sep 19 13:55:02 PDT 2009


Revision: 2581
          http://trac.macosforge.org/projects/ruby/changeset/2581
Author:   mattaimonetti at gmail.com
Date:     2009-09-19 13:55:02 -0700 (Sat, 19 Sep 2009)
Log Message:
-----------
Remove code tags for shell examples

Modified Paths:
--------------
    MacRubyWebsite/trunk/content/blog/2008/06/06/macruby_0.2.txt
    MacRubyWebsite/trunk/content/blog/2008/06/16/new_build_system.txt
    MacRubyWebsite/trunk/content/blog/2009/03/09/macruby-0.4.txt

Modified: MacRubyWebsite/trunk/content/blog/2008/06/06/macruby_0.2.txt
===================================================================
--- MacRubyWebsite/trunk/content/blog/2008/06/06/macruby_0.2.txt	2009-09-19 20:55:00 UTC (rev 2580)
+++ MacRubyWebsite/trunk/content/blog/2008/06/06/macruby_0.2.txt	2009-09-19 20:55:02 UTC (rev 2581)
@@ -29,7 +29,7 @@
 
 Inserting elements in an array is faster in MacRuby than the original 1.9 implementation, for example, mostly because CFArray switches on the fly its data structure to an implementation that performs well according to the current number of elements.
 
-<code><pre class="commands">
+<pre class="commands">
 a=[]; 100_000.times { |i| a.insert(0, i) }
 MacRuby version 0.2 (ruby 1.9.0 2008-06-03) [universal-darwin9.0]
     0.326057
@@ -43,11 +43,11 @@
     4.608796
     4.595334
     4.581045
-</pre></code>
+</pre>
 
-Regarding hashes, searching for a specific value (which isn't something that is typically done) is shown to be faster.
+Regarding hashes, searching for a specific value (which isn't something that is typically done) is shown to be faster. k
 
-<code><pre class="commands">
+<pre class="commands">
 h = Hash[*(1..10000).to_a]; 10000.times { |i| h.has_value?(i) }
 MacRuby version 0.2 (ruby 1.9.0 2008-06-03) [universal-darwin9.0]
     0.965304
@@ -61,11 +61,11 @@
     4.225632
     4.225457
     4.239244
-</pre></code>
+</pre>
 
 And to finish with strings, it turns out that manipulations on multi-byte strings are faster in MacRuby than 1.9.
 
-<code><pre class="commands">
+<pre class="commands">
 $ cat t3.rb 
 # -*- coding: utf-8 -*-
 s = "わたしはロランです。" * 2000
@@ -79,11 +79,11 @@
     1.624943
     1.633502
     1.62767
-</pre></code>
+</pre>
 
 Speaking of strings, since every of them is now a CFString, they get for free features that weren't present in the original 1.9 implementation, such as ICU transformations for example:
 
-<code><pre class="commands">
+<pre class="commands">
 $ cat t3.rb
 puts "watashiha".transform('Latin-Hiragana') +
      "lauren".transform('Latin-Katakana') +
@@ -91,7 +91,7 @@
 $ macruby -v t3.rb
 MacRuby version 0.2 (ruby 1.9.0 2008-05-17) [universal-darwin9.0]
 わたしはラウレンです。
-</pre></code>
+</pre>
 
 MacRuby is still slower in many cases, including very important ones such as objects allocation and methods dispatch. There are also too many areas in String, Array and Hash where we perform much less well than we should.
 

Modified: MacRubyWebsite/trunk/content/blog/2008/06/16/new_build_system.txt
===================================================================
--- MacRubyWebsite/trunk/content/blog/2008/06/16/new_build_system.txt	2009-09-19 20:55:00 UTC (rev 2580)
+++ MacRubyWebsite/trunk/content/blog/2008/06/16/new_build_system.txt	2009-09-19 20:55:02 UTC (rev 2581)
@@ -15,16 +15,16 @@
 
 Building and installing MacRuby is now very simple:
 
-<code><pre class="commands">
+<pre class="commands">
 $ rake
 $ sudo rake install
-</pre></code>
+</pre>
 
 This will build and install MacRuby in /Library/Frameworks/MacRuby.framework, executable symbolic links in /usr/local/bin (with a "mac" prefix, for example "macruby"), Xcode templates and sample code.
 
 To see the list of all tasks;
 
-<code><pre class="commands">
+<pre class="commands">
 $ rake -T
 (in /Volumes/Data/src/MacRuby)
 rake all                   # Build MacRuby and extensions
@@ -46,13 +46,13 @@
 rake rbconfig              # Create config file
 rake sample_test           # Run the sample tests
 rake test                  # Same as sample_test
-</pre></code>
+</pre>
 
 Also, MacRuby trunk has a faster Objective-C dispatcher. Around 4 times faster that MacRuby 0.2 (and way faster than RubyCocoa). This was possible by fixing bugs in the dispatcher and also cache some of the runtime information.
 
 Let's consider the following Objective-C class.
 
-<code><pre class="commands">
+<pre class="commands">
 $ cat dummy.m
 #import <Foundation/Foundation.h>
 
@@ -74,17 +74,17 @@
 @end
 
 void Init_dummy (void) {}
-</pre></code>
+</pre>
 
 We can build it as a Ruby extension.
 
-<code><pre class="commands">
+<pre class="commands">
 $ gcc dummy.m -o dummy.bundle -framework Foundation -dynamiclib -fobjc-gc"
-</pre></code>
+</pre>
 
 Then, test calling the methods. First, the doSomething method, which is a very simple case.
 
-<code><pre class="commands">
+<pre class="commands">
 $ ruby start.rb ruby -v -r osx/foundation -I. -r dummy -e "include OSX; o = Dummy.new; 1_000_000.times { o.doSomething }"
 ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
     5.295735
@@ -100,11 +100,11 @@
     0.639648
     0.65196
     0.644522
-</pre></code>
+</pre>
 
 Then, the doSomethingWith: method, a bit more complicated because one argument is passed, so both RubyCocoa and MacRuby are using libffi to call it.
 
-<code><pre class="commands">
+<pre class="commands">
 $ ruby -v -r osx/foundation -I. -r dummy -e "include OSX; o = Dummy.new; o2 = 'foo'; 1_000_000.times { o.doSomethingWith(o2) }"
 ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
     13.981403
@@ -120,7 +120,7 @@
     1.239323
     1.259157
     1.246987
-</pre></code>
+</pre>
 
 These are very premature results, we expect to continue reducing the time spent in the dispatcher, in the near future, and hopefully to make it twice faster.
 

Modified: MacRubyWebsite/trunk/content/blog/2009/03/09/macruby-0.4.txt
===================================================================
--- MacRubyWebsite/trunk/content/blog/2009/03/09/macruby-0.4.txt	2009-09-19 20:55:00 UTC (rev 2580)
+++ MacRubyWebsite/trunk/content/blog/2009/03/09/macruby-0.4.txt	2009-09-19 20:55:02 UTC (rev 2581)
@@ -27,7 +27,7 @@
 
 DTrace probes have been added to the core of the interpreter. You can now trace various things such as method calls or exceptions. All of that can be done on any MacRuby processes in the system.
 
-<code><pre class="commands">
+<pre class="commands">
 provider macruby {
     probe insn__entry(char *insnname, char *sourcefile, int sourceline);
     probe insn__return(char *insnname, char *sourcefile, int sourceline);
@@ -36,7 +36,7 @@
     probe raise(char *classname, char *sourcefile, int sourceline);
     probe rescue(char *sourcefile, int sourceline);
 };
-</pre></code>
+</pre>
 
 DTrace is a very powerful tool that has proven to be extremely useful when debugging live applications. MacRuby ships with several DTrace scripts in "/Developer/Examples/Ruby/MacRuby/DTrace":http://www.macruby.org/trac/browser/MacRuby/trunk/sample-macruby/DTrace to profile various things such as method count, duration or even objects collected by the GC.
 
@@ -44,7 +44,7 @@
 
 MacRuby now exposes "an Objective-C API":http://www.macruby.org/trac/browser/MacRuby/trunk/include/ruby/objc.h that can be used to control the runtime from a pure Cocoa environment.
 
-<code><pre class="commands">
+<pre class="commands">
 $ cat hello_macruby.m 
 #import <Foundation/Foundation.h>
 #import <MacRuby/MacRuby.h>
@@ -57,7 +57,7 @@
 $ gcc hello_macruby.m -o hello_macruby -framework Foundation -framework MacRuby -fobjc-gc
 $ ./hello_macruby 
 hello MacRuby
-</pre></code>
+</pre>
 
 It should be helpful if you are working on an Objective-C Cocoa application and are considering using MacRuby to either implement new functionalities or to provide a scripting interface to your native objects.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090919/431df47c/attachment-0001.html>


More information about the macruby-changes mailing list