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

Pim Snel pim at lingewoud.nl
Thu Mar 1 04:26:02 PST 2012


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120301/41e47b07/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refxPrerequisitesInstall.sh
Type: application/octet-stream
Size: 2999 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120301/41e47b07/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120301/41e47b07/attachment-0001.html>


More information about the MacRuby-devel mailing list