Re: [MacRuby-devel] converging for 1.0
GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, IMO) doesn't really matter but I think a switch to almost newer source control system will stop by the use of Xcode. Because Xcode is crappy and supports not distributed source control system.I switched from Java to Ruby and thanks to MacRuby I tried Xcode but hell I can understand how people are able to write code with Xcode ;-)Anyways anything is better then SVN --- Michael Jackson schrieb am Mi, 1.12.2010: Von: Michael Jackson Betreff: Re: [MacRuby-devel] converging for 1.0 An: "MacRuby development discussions." Datum: Mittwoch, 1. Dezember, 2010 06:00 Uhr +1 for using GitHub. Also, it would be great to have some sort of wiki entry on how to contribute to the project. On Tue, Nov 30, 2010 at 8:05 PM, Arthur Gunn wrote: > Hi, > > I'd like to help out with the bugmash on saturday. > I'm wondering, what will the workflow look like? > Will it be possible to use github and it's systems? I think it would lower > the barriers for mac rubyists (like myself) to become involved. Github has > some pretty handy features like its pull request system too. > > Also, some visible guidelines for prospective contributors could be a good > thing. > https://www.macruby.org/trac/wiki/MacRubyDevelopment just says "Please file > a ticket" and is buried (5 clicks by my count) from the homepage. > > Let me know what I can do to help. > > Thanks, > > > -Arthur > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
On 2010-12-01, at 07:45 , denny trebbin wrote: > > GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, IMO) > doesn't really matter but I think a switch to almost newer source control > system will stop by the use of Xcode. Because Xcode is crappy and supports > not distributed source control system.I switched from Java to Ruby and thanks > to MacRuby I tried Xcode but hell I can understand how people are able to > write code with Xcode ;-)Anyways anything is better then SVN How much can we talk about Xcode 4 wrt SCM integration? Well, I guess if you have ADC, go check it out. ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
> From: Caio Chassot > On 2010-12-01, at 07:45 , denny trebbin wrote: >> >> GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, IMO) >> doesn't really matter but I think a switch to almost newer source control >> system will stop by the use of Xcode. Because Xcode is crappy and supports >> not distributed source control system.I switched from Java to Ruby and >> thanks to MacRuby I tried Xcode but hell I can understand how people are >> able to write code with Xcode ;-)Anyways anything is better then SVN > > How much can we talk about Xcode 4 wrt SCM integration? mention of the git support in Xcode 4 is on a no login required page at apple, so I guess that feature is considered "public" now... http://developer.apple.com/technologies/tools/whats-new.html#version-editor cheers Russell - Russell Muetzelfeldt Mundus vult decipi, ergo decipiatur. ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
If you’d prefer to work against the https://github.com/MacRuby/MacRuby mirror, then by all means please do. I'll take pull requests, and others will probably to, but it would be a good idea to send links to these requests in the IRC channel too, as I *think* the emails will go to a black hole. However, cleaning up the existing mess is the first priority, moving to another stack would only further delay this. So for now we are bound to Trac and SVN as the main stack. I too feel the pain… On Wed, Dec 1, 2010 at 2:06 PM, russell muetzelfeldt wrote: >> From: Caio Chassot >> On 2010-12-01, at 07:45 , denny trebbin wrote: >>> >>> GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, >>> IMO) doesn't really matter but I think a switch to almost newer source >>> control system will stop by the use of Xcode. Because Xcode is crappy and >>> supports not distributed source control system.I switched from Java to Ruby >>> and thanks to MacRuby I tried Xcode but hell I can understand how people >>> are able to write code with Xcode ;-)Anyways anything is better then SVN >> >> How much can we talk about Xcode 4 wrt SCM integration? > > mention of the git support in Xcode 4 is on a no login required page at > apple, so I guess that feature is considered "public" now... > > http://developer.apple.com/technologies/tools/whats-new.html#version-editor > > > cheers > > Russell > > - > Russell Muetzelfeldt > Mundus vult decipi, ergo decipiatur. > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
Come on people svn isn't that bad, most of us used it for years and might still use it ;) However, if you are a git addict, you have 3 options: * use the github mirror (we'll do the svn patching ourselves) * use the macosforge git repo (same as github) * use gitsvn Also, while you are reflecting on your options, please pause a second in respect for people like me having to use perforce on a regular basis ;) Thank you all, your contribution will make the next release even better. - Matt Sent from my iPhone On Dec 1, 2010, at 6:42, Eloy Duran wrote: > If you’d prefer to work against the https://github.com/MacRuby/MacRuby > mirror, then by all means please do. I'll take pull requests, and > others will probably to, but it would be a good idea to send links to > these requests in the IRC channel too, as I *think* the emails will go > to a black hole. > > However, cleaning up the existing mess is the first priority, moving > to another stack would only further delay this. So for now we are > bound to Trac and SVN as the main stack. I too feel the pain… > > On Wed, Dec 1, 2010 at 2:06 PM, russell muetzelfeldt > wrote: >>> From: Caio Chassot >>> On 2010-12-01, at 07:45 , denny trebbin wrote: GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, IMO) doesn't really matter but I think a switch to almost newer source control system will stop by the use of Xcode. Because Xcode is crappy and supports not distributed source control system.I switched from Java to Ruby and thanks to MacRuby I tried Xcode but hell I can understand how people are able to write code with Xcode ;-)Anyways anything is better then SVN >>> >>> How much can we talk about Xcode 4 wrt SCM integration? >> >> mention of the git support in Xcode 4 is on a no login required page at >> apple, so I guess that feature is considered "public" now... >> >> http://developer.apple.com/technologies/tools/whats-new.html#version-editor >> >> >> cheers >> >> Russell >> >> - >> Russell Muetzelfeldt >> Mundus vult decipi, ergo decipiatur. >> >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
The voice of reason - thanks Matt. Matt On Dec 1, 2010, at 7:29 AM, Matt Aimonetti wrote: > Come on people svn isn't that bad, most of us used it for years and might > still use it ;) > However, if you are a git addict, you have 3 options: > * use the github mirror (we'll do the svn patching ourselves) > * use the macosforge git repo (same as github) > * use gitsvn > > Also, while you are reflecting on your options, please pause a second in > respect for people like me having to use perforce on a regular basis ;) > > Thank you all, your contribution will make the next release even better. > > - Matt > > Sent from my iPhone > > On Dec 1, 2010, at 6:42, Eloy Duran wrote: > >> If you’d prefer to work against the https://github.com/MacRuby/MacRuby >> mirror, then by all means please do. I'll take pull requests, and >> others will probably to, but it would be a good idea to send links to >> these requests in the IRC channel too, as I *think* the emails will go >> to a black hole. >> >> However, cleaning up the existing mess is the first priority, moving >> to another stack would only further delay this. So for now we are >> bound to Trac and SVN as the main stack. I too feel the pain… >> >> On Wed, Dec 1, 2010 at 2:06 PM, russell muetzelfeldt >> wrote: From: Caio Chassot On 2010-12-01, at 07:45 , denny trebbin wrote: > > GitHub or BitBucket (I love Mercurial, its pretty much easier then Git, > IMO) doesn't really matter but I think a switch to almost newer source > control system will stop by the use of Xcode. Because Xcode is crappy and > supports not distributed source control system.I switched from Java to > Ruby and thanks to MacRuby I tried Xcode but hell I can understand how > people are able to write code with Xcode ;-)Anyways anything is better > then SVN How much can we talk about Xcode 4 wrt SCM integration? >>> >>> mention of the git support in Xcode 4 is on a no login required page at >>> apple, so I guess that feature is considered "public" now... >>> >>> http://developer.apple.com/technologies/tools/whats-new.html#version-editor >>> >>> >>> cheers >>> >>> Russell >>> >>> - >>> Russell Muetzelfeldt >>> Mundus vult decipi, ergo decipiatur. >>> >>> ___ >>> MacRuby-devel mailing list >>> [email protected] >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel smime.p7s Description: S/MIME cryptographic signature ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Regular expression related performance
Hello,
I'm rewriting an app for text analysis in MacRuby, which I originally wrote in
RubyCocoa. But I encountered a serious performance issue in MacRuby, which is
related to processing text using regular expressions.
I'm wondering if this will be taken care of in the near future (or already done
in 0.8?).
Below are my simple tests. The first two are essentially the same with a
slightly different approach. Both are simply counting frequency of each word.
I want to use the first approach not to count word frequencies, but in other
processes. The third one is to test the speed of String#gsub with regular
expression. I felt String#gsub was slow in my app, so I just wanted to test
how slow it is compared to RubyCocoa.
Test 1 - scan-block
freq = Hash.new(0)
text.scan(/\w+/) do |word|
freq[word] += 1
end
Test 2 - scan array.each
freq = Hash.new(0)
text.scan(/\w+/).each do |word|
freq[word] += 1
end
Test 3 - gsub upcase
text.gsub!(/\w+/){|x| x.upcase}
The results are in seconds. The original text is in English with 8154 words.
Each process was repeated 10 times to calculate processing times. Each test
were done 3 times.
Ruby 1.8.7 Test1 - scan-block: 0.542,0.502,
0.518
Ruby 1.8.7 Test2 - scan array.each: 0.399,0.392,
0.399
Ruby 1.8.7 Test3 - gsub upcase: 0.384,0.349,0.390
MacRuby 0.7.1 Test1 - scan-block: 27.612, 27.707, 27.453
MacRuby 0.7.1 Test2 - scan array.each:3.556,3.616,3.554
MacRuby 0.7.1 Test3 - gsub upcase: 27.613, 26.826, 27.327
Thanks,
Yasu
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Compile target
Hi MacRuby devotees: Would it be possible to configure XCODE and macruby_deploy to produce the compiled output in a separate folder and not delete the .rb source files? The .rbo files should be given the same time stamp as the .rb file so that recompiling could be optimized to only the files that have changed since the last compile. Thanks, Bob Rice ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
On Thu, 2 Dec 2010 02:46:07 +0900 Yasu Imao wrote: > Hello, > > I'm rewriting an app for text analysis in MacRuby, which I > originally wrote in RubyCocoa. But I encountered a serious > performance issue in MacRuby, which is related to processing text > using regular expressions. Is MacRuby using a derivative of the old Henry Spencer regexp library or is it using something more modern? For an explanation of why this is critical, see: http://swtch.com/~rsc/regexp/regexp1.html Perry -- Perry E. [email protected] ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] converging for 1.0
On 1/12/2010, at 10:45 PM, denny trebbin wrote: > I switched from Java to Ruby and thanks to MacRuby I tried Xcode but hell I > can understand how people are able to write code with Xcode ;-) > Anyways anything is better then SVN "Don't show me your tools, show me what you made with them" ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
Hi, On Dec 1, 2010, at 12:59 PM, Perry E. Metzger wrote: > On Thu, 2 Dec 2010 02:46:07 +0900 Yasu Imao > wrote: >> Hello, >> >> I'm rewriting an app for text analysis in MacRuby, which I >> originally wrote in RubyCocoa. But I encountered a serious >> performance issue in MacRuby, which is related to processing text >> using regular expressions. > > Is MacRuby using a derivative of the old Henry Spencer regexp library > or is it using something more modern? For an explanation of why this > is critical, see: > > http://swtch.com/~rsc/regexp/regexp1.html MacRuby is using ICU. I'm not aware of ICU's internals, but I suspect the performance issue is probably elsewhere here, given the huge difference against 1.8. Laurent___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
On Dec 1, 2010, at 2:15 PM, Laurent Sansonetti wrote: >> http://swtch.com/~rsc/regexp/regexp1.html > > MacRuby is using ICU. I'm not aware of ICU's internals, but I suspect the > performance issue is probably elsewhere here, given the huge difference > against 1.8. It would be instructive to try and reduce this case somewhat, just in case that's true. At the very least, it would be interesting to compile MacRuby with profiling enabled, run the test, and then see where all the hotspot calls were. Do we have an easy way of doing that with the existing rakefiles? - Jordan ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
On Dec 1, 2010, at 2:20 PM, Jordan K. Hubbard wrote: > > On Dec 1, 2010, at 2:15 PM, Laurent Sansonetti wrote: > >>> http://swtch.com/~rsc/regexp/regexp1.html >> >> MacRuby is using ICU. I'm not aware of ICU's internals, but I suspect the >> performance issue is probably elsewhere here, given the huge difference >> against 1.8. > > It would be instructive to try and reduce this case somewhat, just in case > that's true. At the very least, it would be interesting to compile MacRuby > with profiling enabled, run the test, and then see where all the hotspot > calls were. Do we have an easy way of doing that with the existing rake > files? The easiest way is probably to use Shark (that's what I always do). No need to recompile the project then :) I will investigate the problem but I already suspect it's because of libauto's slow allocator. Laurent ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
Hi Yasu,
I ran your tests in Shark. Tests 1 and 3 are significantly slower because #scan
and #gsub are called with a block, which means MacRuby has to create a new
Match object for every yield, to conform to the Ruby specs. Each Match object
contains a copy of the original string.
MacRuby has a slow memory allocator (much slower than the original Ruby), so
one must be careful to not allocate too many objects. This is something we are
working on, unfortunately MacRuby doesn't fully control the object allocator,
as it resides in the libauto library (the Objective-C garbage collector).
In your case, I recommend using the method in Test 2, which is to not pass a
block.
It is possible that we can reduce memory usage when doing regexps in MacRuby,
however after having a quick look at the source code I am not sure something
can be done for 0.8 :(
Laurent
On Dec 1, 2010, at 9:46 AM, Yasu Imao wrote:
> Hello,
>
> I'm rewriting an app for text analysis in MacRuby, which I originally wrote
> in RubyCocoa. But I encountered a serious performance issue in MacRuby,
> which is related to processing text using regular expressions.
>
> I'm wondering if this will be taken care of in the near future (or already
> done in 0.8?).
>
> Below are my simple tests. The first two are essentially the same with a
> slightly different approach. Both are simply counting frequency of each
> word. I want to use the first approach not to count word frequencies, but in
> other processes. The third one is to test the speed of String#gsub with
> regular expression. I felt String#gsub was slow in my app, so I just wanted
> to test how slow it is compared to RubyCocoa.
>
>
> Test 1 - scan-block
>
> freq = Hash.new(0)
> text.scan(/\w+/) do |word|
> freq[word] += 1
> end
>
>
> Test 2 - scan array.each
>
> freq = Hash.new(0)
> text.scan(/\w+/).each do |word|
> freq[word] += 1
> end
>
>
> Test 3 - gsub upcase
>
> text.gsub!(/\w+/){|x| x.upcase}
>
>
> The results are in seconds. The original text is in English with 8154 words.
> Each process was repeated 10 times to calculate processing times. Each test
> were done 3 times.
>
> Ruby 1.8.7 Test1 - scan-block: 0.542,0.502,
> 0.518
> Ruby 1.8.7 Test2 - scan array.each: 0.399,0.392,
> 0.399
> Ruby 1.8.7 Test3 - gsub upcase: 0.384,0.349,0.390
>
> MacRuby 0.7.1 Test1 - scan-block: 27.612, 27.707, 27.453
> MacRuby 0.7.1 Test2 - scan array.each: 3.556,3.616,3.554
> MacRuby 0.7.1 Test3 - gsub upcase:27.613, 26.826, 27.327
>
>
> Thanks,
> Yasu
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
I spoke too fast, having a second look I found that it was possible to make the
Match strings point to a unique object. I committed this optimization in r4964
and verified that no regression is introduced.
Before:
$ time /usr/local/bin/macruby -e "text=File.read('/tmp/foo.txt');
freq=Hash.new(0); text.scan(/\w+/) {}"
real0m2.430s
user0m1.628s
sys 0m1.030s
After :)
$ time ./miniruby -e "text=File.read('/tmp/foo.txt'); freq=Hash.new(0);
text.scan(/\w+/) {}"
real0m0.121s
user0m0.100s
sys 0m0.015s
Laurent
On Dec 1, 2010, at 2:46 PM, Laurent Sansonetti wrote:
> Hi Yasu,
>
> I ran your tests in Shark. Tests 1 and 3 are significantly slower because
> #scan and #gsub are called with a block, which means MacRuby has to create a
> new Match object for every yield, to conform to the Ruby specs. Each Match
> object contains a copy of the original string.
>
> MacRuby has a slow memory allocator (much slower than the original Ruby), so
> one must be careful to not allocate too many objects. This is something we
> are working on, unfortunately MacRuby doesn't fully control the object
> allocator, as it resides in the libauto library (the Objective-C garbage
> collector).
>
> In your case, I recommend using the method in Test 2, which is to not pass a
> block.
>
> It is possible that we can reduce memory usage when doing regexps in MacRuby,
> however after having a quick look at the source code I am not sure something
> can be done for 0.8 :(
>
> Laurent
>
> On Dec 1, 2010, at 9:46 AM, Yasu Imao wrote:
>
>> Hello,
>>
>> I'm rewriting an app for text analysis in MacRuby, which I originally wrote
>> in RubyCocoa. But I encountered a serious performance issue in MacRuby,
>> which is related to processing text using regular expressions.
>>
>> I'm wondering if this will be taken care of in the near future (or already
>> done in 0.8?).
>>
>> Below are my simple tests. The first two are essentially the same with a
>> slightly different approach. Both are simply counting frequency of each
>> word. I want to use the first approach not to count word frequencies, but
>> in other processes. The third one is to test the speed of String#gsub with
>> regular expression. I felt String#gsub was slow in my app, so I just wanted
>> to test how slow it is compared to RubyCocoa.
>>
>>
>> Test 1 - scan-block
>>
>> freq = Hash.new(0)
>> text.scan(/\w+/) do |word|
>> freq[word] += 1
>> end
>>
>>
>> Test 2 - scan array.each
>>
>> freq = Hash.new(0)
>> text.scan(/\w+/).each do |word|
>> freq[word] += 1
>> end
>>
>>
>> Test 3 - gsub upcase
>>
>> text.gsub!(/\w+/){|x| x.upcase}
>>
>>
>> The results are in seconds. The original text is in English with 8154
>> words. Each process was repeated 10 times to calculate processing times.
>> Each test were done 3 times.
>>
>> Ruby 1.8.7Test1 - scan-block: 0.542,0.502,
>> 0.518
>> Ruby 1.8.7Test2 - scan array.each: 0.399,0.392,
>> 0.399
>> Ruby 1.8.7Test3 - gsub upcase: 0.384,0.349,0.390
>>
>> MacRuby 0.7.1 Test1 - scan-block:27.612, 27.707, 27.453
>> MacRuby 0.7.1 Test2 - scan array.each: 3.556,3.616,3.554
>> MacRuby 0.7.1 Test3 - gsub upcase: 27.613, 26.826, 27.327
>>
>>
>> Thanks,
>> Yasu
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Regular expression related performance
Hi Laurent,
This is great! I think I read in the discussion of StringScanner performance
about object allocation (though I didn't understand what exactly was happening
behind the scene), so I guessed it was about 'using block' with regular
expression match data.
For a word frequency count feature, I could use Test 2 script, but for other
part of the app, I needed match information ($`, $' to be exact), so this
performance improvement means a lot to my app.
Is this going to be in 0.8? Then, I'll test this with my app.
By the way, the regular expression itself seems to have a bug (not related to
this, but to negative look-ahead) and I issued(?) a ticket (though I'm not sure
I did it properly).
Best,
Yasu
On 2010/12/02, at 8:50, Laurent Sansonetti wrote:
> I spoke too fast, having a second look I found that it was possible to make
> the Match strings point to a unique object. I committed this optimization in
> r4964 and verified that no regression is introduced.
>
> Before:
>
> $ time /usr/local/bin/macruby -e "text=File.read('/tmp/foo.txt');
> freq=Hash.new(0); text.scan(/\w+/) {}"
>
> real 0m2.430s
> user 0m1.628s
> sys 0m1.030s
>
> After :)
>
> $ time ./miniruby -e "text=File.read('/tmp/foo.txt'); freq=Hash.new(0);
> text.scan(/\w+/) {}"
>
> real 0m0.121s
> user 0m0.100s
> sys 0m0.015s
>
> Laurent
>
> On Dec 1, 2010, at 2:46 PM, Laurent Sansonetti wrote:
>
>> Hi Yasu,
>>
>> I ran your tests in Shark. Tests 1 and 3 are significantly slower because
>> #scan and #gsub are called with a block, which means MacRuby has to create a
>> new Match object for every yield, to conform to the Ruby specs. Each Match
>> object contains a copy of the original string.
>>
>> MacRuby has a slow memory allocator (much slower than the original Ruby), so
>> one must be careful to not allocate too many objects. This is something we
>> are working on, unfortunately MacRuby doesn't fully control the object
>> allocator, as it resides in the libauto library (the Objective-C garbage
>> collector).
>>
>> In your case, I recommend using the method in Test 2, which is to not pass a
>> block.
>>
>> It is possible that we can reduce memory usage when doing regexps in
>> MacRuby, however after having a quick look at the source code I am not sure
>> something can be done for 0.8 :(
>>
>> Laurent
>>
>> On Dec 1, 2010, at 9:46 AM, Yasu Imao wrote:
>>
>>> Hello,
>>>
>>> I'm rewriting an app for text analysis in MacRuby, which I originally wrote
>>> in RubyCocoa. But I encountered a serious performance issue in MacRuby,
>>> which is related to processing text using regular expressions.
>>>
>>> I'm wondering if this will be taken care of in the near future (or already
>>> done in 0.8?).
>>>
>>> Below are my simple tests. The first two are essentially the same with a
>>> slightly different approach. Both are simply counting frequency of each
>>> word. I want to use the first approach not to count word frequencies, but
>>> in other processes. The third one is to test the speed of String#gsub with
>>> regular expression. I felt String#gsub was slow in my app, so I just
>>> wanted to test how slow it is compared to RubyCocoa.
>>>
>>>
>>> Test 1 - scan-block
>>>
>>> freq = Hash.new(0)
>>> text.scan(/\w+/) do |word|
>>> freq[word] += 1
>>> end
>>>
>>>
>>> Test 2 - scan array.each
>>>
>>> freq = Hash.new(0)
>>> text.scan(/\w+/).each do |word|
>>> freq[word] += 1
>>> end
>>>
>>>
>>> Test 3 - gsub upcase
>>>
>>> text.gsub!(/\w+/){|x| x.upcase}
>>>
>>>
>>> The results are in seconds. The original text is in English with 8154
>>> words. Each process was repeated 10 times to calculate processing times.
>>> Each test were done 3 times.
>>>
>>> Ruby 1.8.7 Test1 - scan-block: 0.542,0.502,
>>> 0.518
>>> Ruby 1.8.7 Test2 - scan array.each: 0.399,0.392,
>>> 0.399
>>> Ruby 1.8.7 Test3 - gsub upcase: 0.384,0.349,0.390
>>>
>>> MacRuby 0.7.1 Test1 - scan-block: 27.612, 27.707, 27.453
>>> MacRuby 0.7.1 Test2 - scan array.each:3.556,3.616,3.554
>>> MacRuby 0.7.1 Test3 - gsub upcase: 27.613, 26.826, 27.327
>>>
>>>
>>> Thanks,
>>> Yasu
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.c
Re: [MacRuby-devel] Regular expression related performance
Hi Yasu,
It's committed to trunk, it should be available in tonight's nightly build, so
feel free to grab it :) http://www.macruby.org/files/nightlies. It will also be
in the upcoming 0.8 release.
I see your ticket about the look-ahead regexp bug, I will have a look later
today. Thanks for reporting the problem. Hopefully it can also be fixed for 0.8.
Laurent
On Dec 1, 2010, at 4:29 PM, Yasu Imao wrote:
> Hi Laurent,
>
> This is great! I think I read in the discussion of StringScanner performance
> about object allocation (though I didn't understand what exactly was
> happening behind the scene), so I guessed it was about 'using block' with
> regular expression match data.
>
> For a word frequency count feature, I could use Test 2 script, but for other
> part of the app, I needed match information ($`, $' to be exact), so this
> performance improvement means a lot to my app.
>
> Is this going to be in 0.8? Then, I'll test this with my app.
>
> By the way, the regular expression itself seems to have a bug (not related to
> this, but to negative look-ahead) and I issued(?) a ticket (though I'm not
> sure I did it properly).
>
> Best,
> Yasu
>
> On 2010/12/02, at 8:50, Laurent Sansonetti wrote:
>
>> I spoke too fast, having a second look I found that it was possible to make
>> the Match strings point to a unique object. I committed this optimization in
>> r4964 and verified that no regression is introduced.
>>
>> Before:
>>
>> $ time /usr/local/bin/macruby -e "text=File.read('/tmp/foo.txt');
>> freq=Hash.new(0); text.scan(/\w+/) {}"
>>
>> real 0m2.430s
>> user 0m1.628s
>> sys 0m1.030s
>>
>> After :)
>>
>> $ time ./miniruby -e "text=File.read('/tmp/foo.txt'); freq=Hash.new(0);
>> text.scan(/\w+/) {}"
>>
>> real 0m0.121s
>> user 0m0.100s
>> sys 0m0.015s
>>
>> Laurent
>>
>> On Dec 1, 2010, at 2:46 PM, Laurent Sansonetti wrote:
>>
>>> Hi Yasu,
>>>
>>> I ran your tests in Shark. Tests 1 and 3 are significantly slower because
>>> #scan and #gsub are called with a block, which means MacRuby has to create
>>> a new Match object for every yield, to conform to the Ruby specs. Each
>>> Match object contains a copy of the original string.
>>>
>>> MacRuby has a slow memory allocator (much slower than the original Ruby),
>>> so one must be careful to not allocate too many objects. This is something
>>> we are working on, unfortunately MacRuby doesn't fully control the object
>>> allocator, as it resides in the libauto library (the Objective-C garbage
>>> collector).
>>>
>>> In your case, I recommend using the method in Test 2, which is to not pass
>>> a block.
>>>
>>> It is possible that we can reduce memory usage when doing regexps in
>>> MacRuby, however after having a quick look at the source code I am not sure
>>> something can be done for 0.8 :(
>>>
>>> Laurent
>>>
>>> On Dec 1, 2010, at 9:46 AM, Yasu Imao wrote:
>>>
Hello,
I'm rewriting an app for text analysis in MacRuby, which I originally
wrote in RubyCocoa. But I encountered a serious performance issue in
MacRuby, which is related to processing text using regular expressions.
I'm wondering if this will be taken care of in the near future (or already
done in 0.8?).
Below are my simple tests. The first two are essentially the same with a
slightly different approach. Both are simply counting frequency of each
word. I want to use the first approach not to count word frequencies, but
in other processes. The third one is to test the speed of String#gsub
with regular expression. I felt String#gsub was slow in my app, so I just
wanted to test how slow it is compared to RubyCocoa.
Test 1 - scan-block
freq = Hash.new(0)
text.scan(/\w+/) do |word|
freq[word] += 1
end
Test 2 - scan array.each
freq = Hash.new(0)
text.scan(/\w+/).each do |word|
freq[word] += 1
end
Test 3 - gsub upcase
text.gsub!(/\w+/){|x| x.upcase}
The results are in seconds. The original text is in English with 8154
words. Each process was repeated 10 times to calculate processing times.
Each test were done 3 times.
Ruby 1.8.7 Test1 - scan-block: 0.542,0.502,
0.518
Ruby 1.8.7 Test2 - scan array.each: 0.399,0.392,
0.399
Ruby 1.8.7 Test3 - gsub upcase: 0.384,0.349,0.390
MacRuby 0.7.1 Test1 - scan-block: 27.612, 27.707, 27.453
MacRuby 0.7.1 Test2 - scan array.each: 3.556,3.616,3.554
MacRuby 0.7.1 Test3 - gsub upcase: 27.613, 26.826, 27.327
Thanks,
Yasu
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/lis
Re: [MacRuby-devel] Regular expression related performance
On Dec 1, 2010, at 3:50 PM, Laurent Sansonetti wrote:
> Before:
>
> $ time /usr/local/bin/macruby -e "text=File.read('/tmp/foo.txt');
> freq=Hash.new(0); text.scan(/\w+/) {}"
>
> real 0m2.430s
> user 0m1.628s
> sys 0m1.030s
>
> After :)
>
> $ time ./miniruby -e "text=File.read('/tmp/foo.txt'); freq=Hash.new(0);
> text.scan(/\w+/) {}"
>
> real 0m0.121s
> user 0m0.100s
> sys 0m0.015s
Two orders of magnitude faster! *Nice*!
- Jordan
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Compile target
Hi Robert, Sounds like a good enhancement, could you file a ticket? Laurent On Dec 1, 2010, at 11:15 AM, Robert Rice wrote: > Hi MacRuby devotees: > > Would it be possible to configure XCODE and macruby_deploy to produce the > compiled output in a separate folder and not delete the .rb source files? The > .rbo files should be given the same time stamp as the .rb file so that > recompiling could be optimized to only the files that have changed since the > last compile. > > Thanks, > Bob Rice > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Getting a pointer to a boxed type
Hi, With the recent closing of ticket #1002 I have been trying to take a bunch of Objective-C code and write it in MacRuby. One problem that I have run into is with the AXValueGetValue() function in AXValue.h. The last argument to the function is supposed to be the address of a structure to populate; a fragment of that code would look like this: AXValueRef value = (AXValueRef)[self valueOfAttribute:attribute]; CGPoint point; AXValueGetValue( value, kAXValueCGPointType, &point ); return point; If I wanted to write this in MacRuby I think I would have to do something like this: value = valueOfAttribute attribute point = CGPoint.new AXValueGetValue( value, KAXValueCGPointType, point.address_of ) point Except that I have not come across a way to get the address of an object in MacRuby. I have tried the #object_id but then I get errors about the function wanting a Pointer. Is there a way to get a pointer to a specific object or a way to get the address of an object? Thanks, Mark ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Getting a pointer to a boxed type
Hi Mark, I think the following would work: value = valueOfAttribute attribute point_ptr = Pointer.new(CGPoint.type) AXValueGetValue( value, KAXValueCGPointType, point_ptr ) point = point_ptr[0] Basically, you want to pass a pointer to a CGPoint to the API. Laurent On Dec 1, 2010, at 10:16 PM, Mark Rada wrote: > Hi, > > With the recent closing of ticket #1002 I have been trying to take a bunch of > Objective-C code and write it in MacRuby. > > One problem that I have run into is with the AXValueGetValue() function in > AXValue.h. The last argument to the function is supposed to be the address of > a structure to populate; a fragment of that code would look like this: > > AXValueRef value = (AXValueRef)[self valueOfAttribute:attribute]; > CGPoint point; > AXValueGetValue( value, kAXValueCGPointType, &point ); > return point; > > If I wanted to write this in MacRuby I think I would have to do something > like this: > > value = valueOfAttribute attribute > point = CGPoint.new > AXValueGetValue( value, KAXValueCGPointType, point.address_of ) > point > > Except that I have not come across a way to get the address of an object in > MacRuby. I have tried the #object_id but then I get errors about the function > wanting a Pointer. > > Is there a way to get a pointer to a specific object or a way to get the > address of an object? > > Thanks, > Mark > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
