Skip to content

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Nov 7, 2022

ref #20777

todo

  • cpp
  • downcast
  • benchmarks

Here is the benchmark #18612 (comment)

@ringabout ringabout changed the title implement display based subtype checking implement display based subtype checking (massive speedup; same performance level with refc threads:off) Nov 7, 2022
@ringabout ringabout changed the title implement display based subtype checking (massive speedup; same performance level with refc threads:off) implements display based subtype checking (massive speedup; same performance level with refc threads:off) Nov 7, 2022
@ringabout ringabout changed the title implements display based subtype checking (massive speedup; same performance level with refc threads:off) implements display based subtype checking Nov 8, 2022
@ringabout ringabout changed the title implements display based subtype checking implements display based subtype checking (6.4x faster without threads; 2.8x faster with threads) Nov 8, 2022
@Araq
Copy link
Member

Araq commented Nov 8, 2022

I declare this to be crucial for version 2.

@ringabout ringabout marked this pull request as ready for review November 8, 2022 09:24
@Araq Araq added merge_when_passes_CI mergeable once green and removed Showstopper labels Nov 8, 2022
@Araq
Copy link
Member

Araq commented Nov 8, 2022

CI failure unrelated, merging.

@Araq Araq merged commit 7d15fdd into devel Nov 8, 2022
@Araq Araq deleted the pr_orc_of branch November 8, 2022 12:08
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 7d15fdd

Hint: mm: orc; opt: speed; options: -d:release
165062 lines; 8.223s; 614.25MiB peakmem

@rockcavera
Copy link
Contributor

This PR broke compiler compilation here.

e:\Nim>koch boot -d:release --skipUserCfg --skipParentCfg
iteration: 1
bin\nim.exe c  --skipUserCfg --skipParentCfg -d:nimKochBootstrap --nimcache:nimcache/r_windows_amd64 -d:release --skipUserCfg --skipParentCfg --noNimblePath --compileOnly compiler\nim.nim
Hint: used config file 'e:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'e:\Nim\config\config.nims' [Conf]
Hint: used config file 'e:\Nim\compiler\nim.cfg' [Conf]
...............................................................................................................................................................................................................................
e:\Nim\compiler\ccgutils.nim(56, 14) Warning: target type is larger than source type
  target type: 'Hash' (8 bytes)
  source type: 'uint32' (4 bytes) [CastSizes]
................
e:\Nim\compiler\vmops.nim(149, 8) Warning: gc is deprecated [Deprecated]
..................................................................
Error: system module needs: isObjWithCache
FAILURE
nim -v
Nim Compiler Version 1.7.3 [Windows: amd64]
Compiled at 2022-11-08
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: ca3b6cba5dca1b0f73d8dec7476d440af9780567
active boot switches: -d:release

@ringabout
Copy link
Member Author

ringabout commented Nov 8, 2022

Hi @rockcavera
How about clearing the nimcache and removing the old bin/nim executable?

@rockcavera
Copy link
Contributor

@ringabout , It worked! Thanks.

@ringabout
Copy link
Member Author

No problem.

@rockcavera
Copy link
Contributor

Looks like this PR caused a regression in performance using --mm:refc and --threads:on

REFC

before this PR -d:release --mm:refc --threads:off
 Proc with ref object 0.107
 Closures 2.246
 Methods 0.3599999999999999

after this PR -d:release --mm:refc --threads:off
 Proc with ref object 0.108
 Closures 2.092
 Methods 0.3260000000000001

before this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 4.382000000000001
 Methods 0.4370000000000003

after this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 11.914
 Methods 1.298999999999999


ARC

before this PR -d:release --mm:arc --threads:off
 Proc with ref object 0.107
 Closures 1.78
 Methods 2.605

after this PR -d:release --mm:arc --threads:off
 Proc with ref object 0.108
 Closures 1.645
 Methods 0.3240000000000003

before this PR -d:release --mm:arc --threads:on
 Proc with ref object 0.108
 Closures 7.931
 Methods 4.205

after this PR -d:release --mm:arc --threads:on
 Proc with ref object 0.108
 Closures 7.888
 Methods 1.329999999999999

before this PR -d:release --mm:arc --threads:on -d:useMalloc
 Proc with ref object 0.107
 Closures 13.06
 Methods 3.424999999999999

after this PR -d:release --mm:arc --threads:on -d:useMalloc
 Proc with ref object 0.108
 Closures 14.402
 Methods 1.850999999999999

before this PR -d:release --mm:arc --threads:off -d:useMalloc
 Proc with ref object 0.108
 Closures 9.478
 Methods 2.664999999999999

after this PR -d:release --mm:arc --threads:off -d:useMalloc
 Proc with ref object 0.106
 Closures 9.887
 Methods 0.3569999999999993

@ringabout
Copy link
Member Author

I cannot reproduce on Win11

bin/nim r -d:release --mm:refc --threads:off

 Proc with ref object 0.045
 Closures 1.111
 Methods 0.1920000000000002

bin/nim r -d:release --mm:refc --threads:on

 Proc with ref object 0.046
 Closures 2.146
 Methods 0.2000000000000002

@rockcavera
Copy link
Contributor

I talk about a comparison between performance before PR and after PR:

before this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 4.382000000000001
 Methods 0.4370000000000003

after this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 11.914
 Methods 1.298999999999999

@ringabout
Copy link
Member Author

ringabout commented Nov 8, 2022

True, but in my case, there are no significant differences with threads on/off in refc after my PR, which indicates there shall be no regressions. My result is Methods 0.1920000000000002 vs Methods 0.2000000000000002.

In your case, it is Methods 0.3260000000000001 vs Methods 1.298999999999999.

That's the contradiction.

@Araq
Copy link
Member

Araq commented Nov 8, 2022

The refc code path is not changed at all. No idea what you measure. :P

@rockcavera
Copy link
Contributor

In fact, I must have done something wrong in the last test. I recompiled and re-tested and indeed there is no regression for refc.

before this PR -d:release --mm:refc --threads:off
 Proc with ref object 0.108
 Closures 2.265
 Methods 0.359

after this PR -d:release --mm:refc --threads:off
 Proc with ref object 0.108
 Closures 2.353
 Methods 0.3599999999999999

before this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 4.292999999999999
 Methods 0.4500000000000002

after this PR -d:release --mm:refc --threads:on
 Proc with ref object 0.107
 Closures 4.306
 Methods 0.4340000000000002

@ringabout ringabout mentioned this pull request Nov 9, 2022
capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
…s; 2.8x faster with threads) (nim-lang#20781)

* WIP: fast 'of' operator based on the literature
* implement  display based subtype checking

Co-authored-by: Araq <rumpf_a@web.de>
bung87 pushed a commit to bung87/Nim that referenced this pull request Jul 29, 2023
…s; 2.8x faster with threads) (nim-lang#20781)

* WIP: fast 'of' operator based on the literature
* implement  display based subtype checking

Co-authored-by: Araq <rumpf_a@web.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge_when_passes_CI mergeable once green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants