[#393012] Basic Ruby performance — Dmitry Nikiforov <dniq@...>

Hello all!

43 messages 2012/02/02
[#393013] Re: Basic Ruby performance — Dmitry Nikiforov <dniq@...> 2012/02/02

Here's another example with significantly bigger performance difference:

[#393015] Re: Basic Ruby performance — Ryan Davis <ryand-ruby@...> 2012/02/02

[#393016] Re: Basic Ruby performance — Peter Vandenabeele <peter@...> 2012/02/02

On Fri, Feb 3, 2012 at 12:20 AM, Ryan Davis <ryand-ruby@zenspider.com>wrote:

[#393020] Re: Basic Ruby performance — Ryan Davis <ryand-ruby@...> 2012/02/03

[#393076] Problem migrating to Ruby 1.9.2 — Patrick Bayford <pbayford@...>

Some assistance please - I have a Ruby project, which I started in Ruby

10 messages 2012/02/03

[#393164] Using _ like in Scala? — Marc Heiler <shevegen@...>

fruits = %w( apple banana orange )

27 messages 2012/02/06
[#393201] Re: Using _ like in Scala? — Tony Arcieri <tony.arcieri@...> 2012/02/07

On Mon, Feb 6, 2012 at 10:54 AM, Marc Heiler <shevegen@linuxmail.org> wrote:

[#393204] Re: Using _ like in Scala? — Eric Christopherson <echristopherson@...> 2012/02/07

On Mon, Feb 6, 2012 at 7:21 PM, Tony Arcieri <tony.arcieri@gmail.com> wrote:

[#393206] Re: Using _ like in Scala? — Tony Arcieri <tony.arcieri@...> 2012/02/07

On Mon, Feb 6, 2012 at 5:56 PM, Eric Christopherson <

[#393208] Re: Using _ like in Scala? — Kevin <darkintent@...> 2012/02/07

On Mon, Feb 6, 2012 at 9:07 PM, Tony Arcieri <tony.arcieri@gmail.com> wrote:

[#393216] Re: Using _ like in Scala? — Robert Klemme <shortcutter@...> 2012/02/07

On Tue, Feb 7, 2012 at 6:56 AM, Kevin <darkintent@gmail.com> wrote:

[#393219] Re: Using _ like in Scala? — Josh Cheek <josh.cheek@...> 2012/02/07

On Tue, Feb 7, 2012 at 4:47 AM, Robert Klemme <shortcutter@googlemail.com>wrote:

[#393220] Re: Using _ like in Scala? — Robert Klemme <shortcutter@...> 2012/02/07

On Tue, Feb 7, 2012 at 1:00 PM, Josh Cheek <josh.cheek@gmail.com> wrote:

[#393240] Re: Using _ like in Scala? — Josh Cheek <josh.cheek@...> 2012/02/08

On Tue, Feb 7, 2012 at 9:15 AM, Robert Klemme <shortcutter@googlemail.com>wrote:

[#393254] Re: Using _ like in Scala? — Robert Klemme <shortcutter@...> 2012/02/08

On Wed, Feb 8, 2012 at 3:43 AM, Josh Cheek <josh.cheek@gmail.com> wrote:

[#393259] Re: Using _ like in Scala? — Josh Cheek <josh.cheek@...> 2012/02/08

On Wed, Feb 8, 2012 at 5:58 AM, Robert Klemme <shortcutter@googlemail.com>wrote:

[#393181] Tork 18.0.0 — "Suraj N. Kurapati" <sunaku@...>

Tork - Test with fork - https://github.com/sunaku/tork#readme

16 messages 2012/02/06
[#393183] Re: [ANN] Tork 18.0.0 — Bartosz Dziewoński <matma.rex@...> 2012/02/06

You have faster major version release cycle than Chrome...

[#393189] Re: [ANN] Tork 18.0.0 — Quintus <sutniuq@...> 2012/02/06

Am 06.02.2012 22:07, schrieb Bartosz Dziewoナгki:

[#393203] Re: Tork 18.0.0 — Suraj Kurapati <sunaku@...> 2012/02/07

Marvin G=C3=BClker wrote in post #1044440:

[#393347] Symbol garbage collection — Dido Sevilla <dido.sevilla@...>

I've always wondered why Ruby didn't do garbage collection of symbols,

13 messages 2012/02/10

[#393402] Who Administrates this list and how can the community help save this list from the noise. — andrew mcelroy <sophrinix@...>

It is very clear that this list has been under a incredibly heavy

21 messages 2012/02/11
[#393403] Re: Who Administrates this list and how can the community help save this list from the noise. — serialhex <serialhex@...> 2012/02/11

+1

[#393407] Re: Who Administrates this list and how can the community help save this list from the noise. — Cathy Alomari <cathy1428@...> 2012/02/11

Good luck, I doubt anyone is paying attention. I have seen numerous

[#393410] Re: Who Administrates this list and how can the community help save this list from the noise. — "Darryl L. Pierce" <mcpierce@...> 2012/02/11

On Sat, Feb 11, 2012 at 1:12 PM, Cathy Alomari <cathy1428@gmail.com> wrote:

[#393430] Re: Who Administrates this list and how can the community help save this list from the noise. — Cathy Alomari <cathy1428@...> 2012/02/13

On Sat, Feb 11, 2012 at 10:48 AM, Darryl L. Pierce <mcpierce@gmail.com>wrote:

[#393432] Re: Who Administrates this list and how can the community help save this list from the noise. — Bartosz Dziewoński <matma.rex@...> 2012/02/13

2012/2/13 Cathy Alomari <cathy1428@gmail.com>:

[#393434] Re: Who Administrates this list and how can the community help save this list from the noise. — Rimantas Liubertas <rimantas@...> 2012/02/13

> Have you tried mailing ruby-talk-ctl@ruby-lang.org (mailto:ruby-talk-ctl@ruby-lang.org) with "unsubscribe"

[#393412] the ruby syntax — maven apache <apachemaven0@...>

Hi:

19 messages 2012/02/12
[#393413] Re: the ruby syntax — Bartosz Dziewoński <matma.rex@...> 2012/02/12

When a hash is the last argument to a method, you can skip its open-

[#393416] Re: the ruby syntax — maven apache <apachemaven0@...> 2012/02/12

2012/2/12 Bartosz Dziewo=C5=84ski <matma.rex@gmail.com>

[#393435] Re: the ruby syntax — Saji Hameed <saji@...> 2012/02/13

On Sun, Feb 12, 2012 at 10:49 PM, maven apache <apachemaven0@gmail.com> wro=

[#393546] Difference between 1.9.2 and 1.9.3 — James French <James.French@...>

module A <- line 1

12 messages 2012/02/20
[#393558] Re: Difference between 1.9.2 and 1.9.3 — Dave Aronson <rubytalk2dave@...> 2012/02/21

On Mon, Feb 20, 2012 at 12:25, James French

[#393548] Accessing a local variable through a symbol — Ralph Shnelvar <ralphs@...32.com>

Let's say I have

11 messages 2012/02/20

[#393671] Rubymoticons — Dave Aronson <rubytalk2dave@...>

I was demonstrating injection of a symbol, and noticed a familiar

12 messages 2012/02/28

Re: Problem migrating to Ruby 1.9.2

From: Robert Klemme <shortcutter@...>
Date: 2012-02-09 13:15:01 UTC
List: ruby-talk #393308
On Thu, Feb 9, 2012 at 2:23 AM, Patrick Bayford <pbayford@talktalk.net> wro=
te:
> Robert Klemme wrote in post #1044064:
>> On Sat, Feb 4, 2012 at 4:24 AM, Patrick Bayford <pbayford@talktalk.net>
>> wrote:
>>>>
>>>> Did you consider using Marshal?
>>>>
>>>>> I'd prefer using a proper database but can't get any of those to beha=
ve
>>>>> properly either!!!
>>>>
>>>> What does that mean?
>>
>>> I did try using Marshal, however, while the examples show how to use
>>> dump & load for in memory use, there was not enough information for me
>>> to get it to write to a file! I don't have enough Ruby experience yet t=
o
>>> work out how to do this sort of stuff - I'm a Pascal/Delphi man by
>>> choice, and serializing objects is nearly all down to the coder.
>>
>> The docs at
>> http://www.ruby-doc.org/core-1.9.3/Marshal.html#method-c-dump
>> mention that you can pass an IO object.
>>
>> file_name =3D "foo.bin"
>>
>> # store
>> File.open(file_name, 'wb') {|io| Marshal.dump(obj, io)}
>>
>> # load
>> obj =3D File.open(file_name, 'rb') {|io| Marshal.load(io)}
>>
>> You should take care that "obj" is an object containing everything you
>> want to serialize.
>>
>>> As to the database comment, I have so far been unable to get mySQL
>>> working with Ruby 1.9, and don't (yet) know enough SQLite to make it's
>>> use practical. I have SQL Server too, but that has even poorer support
>>> documentation, as far as Ruby is concerned. Most of my attempts have
>>> failed at the connect stage.
>>
>> I'd try Marshal first. =A0Much simpler to use and quite fast.

> Thanks for the assist Robert - marshal does indeed work - the key for me
> was the IO reference, which is not well explained in the reference
> material!
> However, I have also discovered PStore, which is more convenient for me,
> as it will keep several objects in the same file.

No, the main advantage of PStore over plain vanilla Marshal is
transactional behavior - not the fact that you can store Hashes.  A
Hash can be easily stored with Marshal as well.  As I said: "You
should take care that "obj" is an object containing everything you
want to serialize."  The only difference here is that with PStore you
can read and write individual key value pairs while with Marshal you
need to read and write the complete Hash.  It is just an interface
thing though and PStore reads and writes the complete Hash internally
as well:

irb(main):010:0> f=3D'x.pstore'
=3D> "x.pstore"
irb(main):013:0> ps =3D PStore.new f
=3D> #<PStore:0x202c55a4 @filename=3D"x.pstore", @abort=3Dfalse,
@ultra_safe=3Dfalse, @thread_safe=3Dfalse, @lock=3D#<Mutex:0x202c54dc>>

irb(main):014:0> ps.transaction {ps['a']=3DTime.now}
=3D> 2012-02-09 14:12:17 +0100
irb(main):015:0> File.open(f,'rb') {|io| Marshal.load(io)}
=3D> {"a"=3D>2012-02-09 14:12:17 +0100}

irb(main):016:0> ps.transaction {ps['b']=3DTime.now}
=3D> 2012-02-09 14:12:36 +0100
irb(main):017:0> File.open(f,'rb') {|io|Marshal.load(io)}
=3D> {"a"=3D>2012-02-09 14:12:17 +0100, "b"=3D>2012-02-09 14:12:36 +0100}

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

In This Thread

Prev Next