<< | Index | >>
... /\\xE2\\x80\\x99/ => "’", /\\xE2\\x80\\x9A/ => "‚", /\\xE2\\x80\\x9B/ => "‛", /\\xE2\\x80\\x9C/ => "“", ...
When I use replace by Regexp in multi threads, sometimes script stops in yaml loading.
This caused by that my script is not thread safe.
$ bin/patinfo2csv ../patinfo.yaml.sample ../patinfo.csv.sample ../eancode.txt.sample patinfo[de] converted: 2 rows $ bin/patinfo2csv ../patinfo.yaml.sample ../patinfo.csv.sample ../eancode.txt.sample /usr/local/lib/ruby/1.9.1/psych.rb:154:in `parse': (<unknown>): couldn't parse YAML at line 2984 column 15 (Psych::SyntaxError) from /usr/local/lib/ruby/1.9.1/psych.rb:154:in `parse_stream' from /usr/local/lib/ruby/1.9.1/psych.rb:222:in `load_stream' from /home/yasu/Documents/workspace/ywesee/patinfo2csv/lib/patinfo2csv/loader.rb:35:in `load_yaml' from /home/yasu/Documents/workspace/ywesee/patinfo2csv/lib/patinfo2csv/cli.rb:18:in `run' from bin/patinfo2csv:45:in `<main>'
I updated scripts as thread safe.
Then ran 5 - 10 threads.
In loading and parsing, multi-threads are not effective way.
It could not speed up because I have to use lock by mutex.
107.776218639 sec.
over 20 min.
text
and subheading
total times.
120.169318657 sec.
96.08502092 sec.
144.50163247 sec.