Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jvm] implement typed functions #9208

Merged
merged 8 commits into from
Mar 6, 2020
Merged

[jvm] implement typed functions #9208

merged 8 commits into from
Mar 6, 2020

Conversation

Simn
Copy link
Member

@Simn Simn commented Mar 6, 2020

Instead of using MethodHandle we now create sub-classes of haxe.jvm.Function, which is similar to what genjava does. This is much faster and more portable, but comes at the expense of increased code size.

There are still some things to optimize in that regard, but I'll do that a bit later.

@Simn
Copy link
Member Author

Simn commented Mar 6, 2020

Some numbers!

Before:

              anon:  59,460,935 (100.00%)
     class-to-anon: 115,746,653 (194.65%)
           dynamic:     819,458 (  1.37%)
     field closure:  62,293,594 (104.76%)
             final: 119,627,458 (201.18%)
          instance: 119,461,624 (200.90%)
         interface: 118,431,625 (199.17%)
     local closure:  61,555,244 (103.52%)
    local function:  61,760,265 (103.86%)
          override: 118,713,814 (199.65%)
            static: 117,879,233 (198.24%)
    static closure:  62,556,824 (105.20%)

After:

  Suite: call with 2 args
              anon: 119,041,326 (100.00%)
     class-to-anon: 119,529,594 (100.41%)
           dynamic:  66,212,033 ( 55.62%)
     field closure: 118,752,228 ( 99.75%)
             final: 118,634,051 ( 99.65%)
          instance: 119,508,294 (100.39%)
         interface: 119,584,280 (100.45%)
     local closure: 119,223,602 (100.15%)
    local function: 119,425,084 (100.32%)
          override: 119,589,525 (100.46%)
            static: 119,544,342 (100.42%)
    static closure: 119,468,944 (100.35%)
nadako-convert before: -- TOTAL  20.43400001525879
 nadako-convert after: -- TOTAL  12.132999897003174
formatter-benchmark before: 22.532000064849854
 formatter-benchmark after: 16.901999950408936

@Gama11
Copy link
Member

Gama11 commented Mar 6, 2020

That's awesome! :)

Some genjava vs genjvm numbers would be interesting too.

@Simn
Copy link
Member Author

Simn commented Mar 6, 2020

genjava:

  Suite: call with 2 args
              anon:  23,959,943 (100.00%)
     class-to-anon:  22,331,613 ( 93.20%)
           dynamic:  22,300,974 ( 93.07%)
     field closure:  14,666,964 ( 61.21%)
             final: 116,229,575 (485.09%)
          instance: 115,997,209 (484.12%)
         interface: 116,688,866 (487.01%)
     local closure:  79,517,529 (331.87%)
    local function:  93,364,918 (389.67%)
          override: 116,328,615 (485.51%)
            static: 116,712,443 (487.11%)
    static closure:     477,268 (  1.99%)

Formatter benchmarks are roughly the same. I get a bit of variance there so it's hard to tell, but benchs.haxe.org will tell us once we merge this.

@Simn Simn merged commit ffe7717 into development Mar 6, 2020
@Simn Simn deleted the waneck_functions branch March 6, 2020 17:21
@kevinresol
Copy link
Contributor

Would be interesting to have a blog post explaining all these

@skial skial mentioned this pull request Mar 9, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants