From: info@... Date: 2003-01-22T19:05:41+09:00 Subject: Re: Question regarding threads and perhaps YAML This is a multi-part message in MIME format. ------=_NextPart_000_0071_01C2C1BA.C1F80550 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Oh sorry, that should have read: The thread completes when the file is an empty file (just a dash), but when the file has YAML code, the thread just seems to lock at that part of the code. Also, I have a question regarding the performance of the ruby YAML module. In my test, when I load a big file into a ruby object (200k+) it takes about 20 seconds or so but when I save that object it only takes about 5 seconds. I can't understand why it would take so much longer to read in the object as opposed to saving off the object. I really need the load to only take about 5 seconds too. Anyone know anything more about the performance issues/limitations of ruby YAML? -----Original Message----- From: info@irvinehosting.net [mailto:info@irvinehosting.net] Sent: Wednesday, January 22, 2003 1:27 AM To: ruby-talk ML Subject: Question regarding threads and perhaps YAML Hi, I am learning ruby and writing my first non-trivial program and I'm running into a few issues. First of all, I am having problems getting threading to work consistently. I am simply having the thread execute a code block which loads a YAML file into a ruby object. The thread completes when the file is an empty file (just a dash), but when the file has YAML code, the thread just never seems to lock at that part of the code. When I join it later it does complete properly. Here is the simple code example: loadingthread = Thread.new('maps/currentmap.yml') { |filename| puts "starting thread" mapfile = File.open(filename) puts "opened file" amap = YAML::load(mapfile) puts "generated object" mapfile.close puts "thread all done" } Any advice for a ruby-newbie would be appreciated :) ------=_NextPart_000_0071_01C2C1BA.C1F80550 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Oh = sorry, that=20 should have read:
 
The = thread completes=20 when the file is an empty file (just a dash), but when the file has YAML = code,=20 the thread just seems to lock at that part of the code. =
 
Also, = I have a=20 question regarding the performance of the ruby YAML module. In my test, = when I=20 load a big file into a ruby object (200k+) it takes about 20 seconds or = so but=20 when I save that object it only takes about 5 seconds. I can't = understand why it=20 would take so much longer to read in the object as opposed to saving off = the=20 object. I really need the load to only take about 5 seconds too. Anyone = know=20 anything more about the performance issues/limitations of ruby=20 YAML?
 
-----Original Message-----
From: = info@irvinehosting.net=20 [mailto:info@irvinehosting.net]
Sent: Wednesday, January 22, = 2003=20 1:27 AM
To: ruby-talk ML
Subject: Question = regarding=20 threads and perhaps YAML

Hi, = I am learning=20 ruby and writing my first non-trivial program and I'm running into a = few=20 issues.
 
First of all, I am=20 having problems getting threading to work consistently. I am simply = having the=20 thread execute a code block which loads a YAML file into a = ruby=20 object. The thread completes when the file is an empty file (just a = dash), but=20 when the file has YAML code, the thread just never seems to lock at = that part=20 of the code. When I join it later it does complete properly. Here is = the=20 simple code example:
 
 loadingthread =3D=20 Thread.new('maps/currentmap.yml') { = |filename|
    =20 puts "starting thread"
     mapfile =3D=20 File.open(filename)
     puts "opened=20 file"
     amap =3D=20 YAML::load(mapfile)
     puts "generated=20 object"
     = mapfile.close
    =20 puts "thread all done"
 }
 
Any = advice for a=20 ruby-newbie would be appreciated=20 :)
------=_NextPart_000_0071_01C2C1BA.C1F80550--