Skip to content

Instantly share code, notes, and snippets.

@inokappa
Last active August 29, 2018 11:54
Show Gist options
  • Save inokappa/360cc285d24f0902a11b1d44c90ac30f to your computer and use it in GitHub Desktop.
Save inokappa/360cc285d24f0902a11b1d44c90ac30f to your computer and use it in GitHub Desktop.

Revisions

  1. inokappa revised this gist Aug 29, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,11 @@ JRuby でも awspec が動くのは分かったけど, JVM の起動に引きづ
    ## 実験環境

    ```sh
    $ sw_vers
    ProductName: Mac OS X
    ProductVersion: 10.13.6
    BuildVersion: 17G65

    $ java --version
    java 10.0.2 2018-07-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
  2. inokappa revised this gist Aug 29, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -77,4 +77,5 @@ Finished in 0.59495 seconds (files took 8.46 seconds to load)
    ## 締め

    * とりあえず, JRUBY_OPT に `--dev` を付与することで, 付与しない場合よりも早くなることを確認した
    * でも, CRuby で実行するのと同等まではいかないようだ
    * でも, CRuby で実行するのと同等まではいかないようだ
    * JVM の知識が必要だな...
  3. inokappa revised this gist Aug 29, 2018. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,7 @@

    ## 実験の目的

    JRuby でも awspec が動くのは分かったけど, JVM の起動に引きづられているようで処理時間が CRuby で実行するよりも長くなってしまう.
    これを少しでも短縮する方法を検討する.
    JRuby でも awspec が動くのは分かったけど, JVM の起動に引きづられているようで処理時間が CRuby で実行するよりも長くなってしまう. これを少しでも短縮する方法を検討する.

    ## 実験環境

    @@ -72,4 +71,10 @@ Finished in 0.59495 seconds (files took 8.46 seconds to load)
    * client モードで JVM が起動する
    * JVM を 32bit モードで起動する
    * JIT の無効
    * invokedynamic の無効
    * invokedynamic の無効
    * `-G` オプションは `bundle exec` と同等

    ## 締め

    * とりあえず, JRUBY_OPT に `--dev` を付与することで, 付与しない場合よりも早くなることを確認した
    * でも, CRuby で実行するのと同等まではいかないようだ
  4. inokappa revised this gist Aug 29, 2018. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -65,4 +65,11 @@ Finished in 0.59495 seconds (files took 8.46 seconds to load)
    8 examples, 0 failures
    ```

    ## メモ
    ## メモ

    * https://github.com/jruby/jruby/wiki/Improving-startup-time (起動時間を改善するテクニック)
    * `--dev` フラグを付与することで, 以下のような効果が得られるっぽい
    * client モードで JVM が起動する
    * JVM を 32bit モードで起動する
    * JIT の無効
    * invokedynamic の無効
  5. inokappa revised this gist Aug 29, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ $ ruby --version
    ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
    ```

    上記の環境で awspec 自体のテスト `rake spec:subnet` を実行してみる.
    上記の環境で awspec 自体のテスト `rake spec:subnet` を実行する. また, Ruby 環境については rbenv にて切り替える.

    ## 実験結果

  6. inokappa revised this gist Aug 29, 2018. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,8 @@ $ ruby --version
    ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
    ```

    上記の環境で awspec 自体のテスト `rake spec:subnet` を実行してみる.

    ## 実験結果

    ```sh
    @@ -30,20 +32,21 @@ $ bundle exec rake spec:subnet
    Finished in 0.07609 seconds (files took 2.63 seconds to load)
    8 examples, 0 failures

    # JRuby
    # JRuby 何もオプションをつけない
    $ bundle exec rake spec:subnet
    ........

    Finished in 0.56038 seconds (files took 10.03 seconds to load)
    8 examples, 0 failures

    # JRuby で JRUBY_OPTS='--dev -G' を付与する
    $ JRUBY_OPTS='--dev -G' bundle exec rake spec:subnet
    ........

    Finished in 0.33188 seconds (files took 5.93 seconds to load)
    8 examples, 0 failures

    # JRuby Nailgun 利用
    # JRuby Nailgun 利用し, 且つ, JRUBY_OPTS='--dev -G' を付与する
    $ JRUBY_OPTS='--dev -G' jruby -S --ng bundle exec rake spec:subnet

    (別の端末に出力される)
    @@ -52,11 +55,14 @@ $ JRUBY_OPTS='--dev -G' jruby -S --ng bundle exec rake spec:subnet
    Finished in 0.21025 seconds (files took 6.08 seconds to load)
    8 examples, 0 failures

    # JRuby Nailgun を利用
    $ jruby -S --ng bundle exec rake spec:subnet

    (別の端末に出力される)
    ........

    Finished in 0.59495 seconds (files took 8.46 seconds to load)
    8 examples, 0 failures
    ```
    ```

    ## メモ
  7. inokappa revised this gist Aug 29, 2018. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    # 実験の目的
    # JRuby で awspec を動かすぞ (awspec 自体のテスト実行時間を計測する)

    ## 実験の目的

    JRuby でも awspec が動くのは分かったけど, JVM の起動に引きづられているようで処理時間が CRuby で実行するよりも長くなってしまう.
    これを少しでも短縮する方法を検討する.

    # 実験環境
    ## 実験環境

    ```sh
    $ java --version
    @@ -18,7 +20,7 @@ $ ruby --version
    ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
    ```

    # 実験結果
    ## 実験結果

    ```sh
    # CRuby
  8. inokappa created this gist Aug 29, 2018.
    60 changes: 60 additions & 0 deletions jruby-awspec.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    # 実験の目的

    JRuby でも awspec が動くのは分かったけど, JVM の起動に引きづられているようで処理時間が CRuby で実行するよりも長くなってしまう.
    これを少しでも短縮する方法を検討する.

    # 実験環境

    ```sh
    $ java --version
    java 10.0.2 2018-07-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
    Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

    $ jruby --version
    jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 10.0.2+13 on 10.0.2+13 +jit [darwin-x86_64]

    $ ruby --version
    ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
    ```

    # 実験結果

    ```sh
    # CRuby
    $ bundle exec rake spec:subnet
    ........

    Finished in 0.07609 seconds (files took 2.63 seconds to load)
    8 examples, 0 failures

    # JRuby
    $ bundle exec rake spec:subnet
    ........

    Finished in 0.56038 seconds (files took 10.03 seconds to load)
    8 examples, 0 failures

    $ JRUBY_OPTS='--dev -G' bundle exec rake spec:subnet
    ........

    Finished in 0.33188 seconds (files took 5.93 seconds to load)
    8 examples, 0 failures

    # JRuby Nailgun 利用
    $ JRUBY_OPTS='--dev -G' jruby -S --ng bundle exec rake spec:subnet

    (別の端末に出力される)
    ........

    Finished in 0.21025 seconds (files took 6.08 seconds to load)
    8 examples, 0 failures

    $ jruby -S --ng bundle exec rake spec:subnet

    (別の端末に出力される)
    ........

    Finished in 0.59495 seconds (files took 8.46 seconds to load)
    8 examples, 0 failures
    ```