diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2011-11-25 17:00:16 +0100 |
---|---|---|
committer | Adriaan Moors <adriaanm@gmail.com> | 2011-12-24 17:36:36 +0100 |
commit | fc0c123e3560da190a3daae35214c2be50fd59e6 (patch) | |
tree | 103617341203a282354b74328997a4b7b9f6dbf4 /test/files/run/virtpatmat_unapplyprod.flags | |
parent | 5ee9a14a489c6e56c331914e9db258c0473d4d23 (diff) | |
download | scala-fc0c123e3560da190a3daae35214c2be50fd59e6.tar.gz scala-fc0c123e3560da190a3daae35214c2be50fd59e6.tar.bz2 scala-fc0c123e3560da190a3daae35214c2be50fd59e6.zip |
[vpm] unapplyProd: faster matching for case classes
behold the mythical unapplyProd: it does not exist, yet it promises to speed up pattern matching on case classes
instead of calling the synthetic unapply/unapplySeq, we don't call the mythical synthetic unapplyProd,
since -- if it existed -- it would be the identity anyway for case classes
eventually, we will allow user-defined unapplyProd's, which should give you almost the same speed as case class matching
for user-defined extractors (i.e., you don't have to wrap in an option, just return something on which we can select _i for i = 1 to N, unless it is null, which indicates match failure)
still need to figure out a way to derive the types for the subpatterns, without requiring you to wrap your result in a ProductN
unapplyProd support for vararg case classes
using caseFieldAccessors instead of synthetic _i
now the compiler bootstraps again, and after this optimization, quick.lib overhead is 70%, quick.comp is 50%
(compiling with a locker built using -Yvirtpatmat, and itself generating code for -Yvirtpatmat)
before the optimization, I think the overhead for quick.comp was close to 100% in this scenario
more robust tupleSel for case classes
TODO:
- pos/t602 -- clean up after type inference as in fromCaseClassUnapply
- run/pf-catch -- implement new-style orElse for partial function in uncurry
Diffstat (limited to 'test/files/run/virtpatmat_unapplyprod.flags')
-rw-r--r-- | test/files/run/virtpatmat_unapplyprod.flags | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/files/run/virtpatmat_unapplyprod.flags b/test/files/run/virtpatmat_unapplyprod.flags new file mode 100644 index 0000000000..9769db9257 --- /dev/null +++ b/test/files/run/virtpatmat_unapplyprod.flags @@ -0,0 +1 @@ + -Yvirtpatmat -Xexperimental |