Created
February 4, 2020 13:44
-
-
Save yusukebe/9a695d74d0688236db1b434f2b8a082b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Text::CSV; | |
# 最初にまるごとメモリに読み込んでる。改善できるところ | |
my @a = csv(in => "caribbean.csv"); | |
await do for @a -> @line { | |
start { | |
parse(@line); | |
} | |
} | |
# do for @a -> @line { | |
# parse(@line); | |
# } | |
sub parse(@line) { | |
sleep 10 / 1000; # 時間のかかる処理をさせる(CSVパース関係なくなってて意味ないけど...) | |
say @line[3]; | |
} | |
# 結果 | |
# 同期↓ | |
# raku csv.raku 4.30s user 0.43s system 4% cpu 1:49.63 total | |
# 非同期↓ | |
# raku csv.raku 4.79s user 0.52s system 29% cpu 17.937 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment