[MacRuby-devel] MacRuby gems running very slow, how to debug/improve

Pim Snel pim at lingewoud.nl
Thu Mar 1 05:09:05 PST 2012


Op 1 mrt. 2012, om 14:00 heeft Stian Håklev het volgende geschreven:
> 
> thank you very much for sharing this. However, one of the problems with appscript is that it requires XCode to install, which many non-programmers don't have installed

I'm almost sure that you do not need xcode if you use my script to manually copy the binary appscript files. You the code I attached? 

echo 
echo "INSTALLING APPSCRIPT GEM"

/usr/bin/install -c -m 0755 ae.bundle /Library/Ruby/Site/1.8/universal-darwin11.0
mkdir -p /Library/Ruby/Site/1.8/_aem
mkdir -p /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/_aem/aemreference.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/codecs.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/connect.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/encodingsupport.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/findapp.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/mactypes.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/send.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_aem/typewrappers.rb /Library/Ruby/Site/1.8/_aem
/usr/bin/install -c -m 644 src/lib/_appscript/defaultterminology.rb /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/_appscript/referencerenderer.rb /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/_appscript/reservedkeywords.rb /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/_appscript/safeobject.rb /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/_appscript/terminology.rb /Library/Ruby/Site/1.8/_appscript
/usr/bin/install -c -m 644 src/lib/aem.rb /Library/Ruby/Site/1.8
/usr/bin/install -c -m 644 src/lib/appscript.rb /Library/Ruby/Site/1.8
/usr/bin/install -c -m 644 src/lib/kae.rb /Library/Ruby/Site/1.8
/usr/bin/install -c -m 644 src/lib/osax.rb /Library/Ruby/Site/1.8


> (although it gets easier now that they separated the command line compilers from the rest of the several gig XCode install). But either way, there are other advantages of switching to MacRuby - for example integrated global keyboard shortcuts (through a gem) - currently I am using Keyboard Maestro for this, etc. 
> 
> I really hope people could offer advice on how to help optimize these libraries for MacRuby!
> 
> Stian
> 
> On Thu, Mar 1, 2012 at 07:26, Pim Snel <pim at lingewoud.nl> wrote:
> Hi Stian,
> 
> We use the appscript gem for an Mac App we developed. To install appscript we ask for the Admin password and then we use a custom script to install every file we need. The objc method that calls the Sudo Dialog when files are missing is printer below. Their should be a ruby way to do this. I attached a shell script that installs the appscript gems and the sqlite gems.
> 
> It works great for us.
> 
> Kind regards,
> Pim Snel
> pas3.com
> 
> // checkAppScript checks if the appscript binary are installed. If not it tries to install
>  - (void) checkAppScript
> {
>     NSLog(@"Authorization Start");
>     NSFileManager *fileManager = [[NSFileManager alloc] init];
> 
>     if(![fileManager fileExistsAtPath:@"/Library/Ruby/Site/1.8/universal-darwin11.0/ae.bundle"]){
> 
>         AuthorizationRef authorizationRef;
>         OSStatus status;
>         
>         status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,kAuthorizationFlagDefaults, &authorizationRef);
> 
>         NSString* installAppScriptScriptTmp = [railsRootDir stringByAppendingString:@"/lib/refxPrerequisitesInstall.sh"];
>         const char *installTool = [installAppScriptScriptTmp UTF8String];
>         char *tool_args[] = {};
>         //[installAppScriptScriptTmp release];
>         
>         status = AuthorizationExecuteWithPrivileges(authorizationRef, installTool,kAuthorizationFlagDefaults, tool_args, NULL);
>         
>         NSLog(@"Authorization Result Code: %d", status);
>         // Check for status TODO
>     }
>     
>     [fileManager release];
> }
> 
> 
> 
> Op 28 feb. 2012, om 17:02 heeft Stian Håklev het volgende geschreven:
> 
>> Hi all, 
>> I use a bunch of Ruby Script and appscript-rb, together with a stand-alone keyboard shortcut app to integrate a number of Mac apps. (http://reganmian.net/wiki/researchr:start). I am very interested in the possibility of porting this to MacRuby, because currently my biggest problem is the difficult other users have in installing this workflow (requiring XCode, binary gems, other applications etc). 
>> 
>> However, the two gems that I am absolutely dependent on are bibtex-ruby and citeproc-ruby. These both run extremely slowly on MacRuby. As a very simple example, here are the differences in running a script that only includes the lines 
>> include 'rubygems'
>> include 'bibtex' (or 'citeproc')
>> 
>> Ruby MRI 1.92p80: 0.18 and 0.36
>> MacRuby 0.12: 2.88 and .677
>> 
>> Running the parsing benchmarks for BibTeX in MacRuby is also 20-100 times slower. This makes it unusable for my purposes. 
>> 
>> I wonder how I can address this. The developer asked me for ruby-prof output, but I know that doesn't currently run on MacRuby. I have XCode and Instruments, but having never used XCode for ObjC development, I have no idea about how to configure Instruments to make it useful for his purposes. Any assistance would be greatly appreciated!
>> 
>> Stian Haklev
>> Curriculum, Teaching and Learning / University of Toronto
>> 
>> -- 
>> http://reganmian.net/blog -- Random Stuff that Matters
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 
> 
> 
> -- 
> http://reganmian.net/blog -- Random Stuff that Matters
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120301/3f3c3649/attachment.html>


More information about the MacRuby-devel mailing list