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
Don't allocate Val.Zero for reference types #683
Conversation
Note: this change does change the NIR but doesn't affect the binary representation. |
case Type.Ptr | _: Type.RefKind => Val.Null | ||
case _ => Val.Zero(ty) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binary compatibility hacks are the best.
This considerably improves linking performance on 1G heaps. As discovered by @xuwei-k in https://twitter.com/xuwei_k/status/857620328624701440. |
git clone -b scala-native https://github.com/scalaprops/scalaprops
cd scalaprops
sbt nativeTest/run
|
when succeeded (-Xmx8G) $ ll -h nativeTest/target/scala-2.11/nativetest-out
-rwxr-xr-x 1 kenji 174M Apr 28 23:46 nativeTest/target/scala-2.11/nativetest-out
$ ll -hS nativeTest/target/scala-2.11/native/ | head
total 1486560
-rw-r--r-- 1 kenji 413M Apr 28 23:46 __dispatch.ll
-rw-r--r-- 1 kenji 156M Apr 28 23:46 __dispatch.ll.o
-rw-r--r-- 1 kenji 56M Apr 28 23:45 __class_has_trait.ll
-rw-r--r-- 1 kenji 26M Apr 28 23:45 scalaz.ll
-rw-r--r-- 1 kenji 11M Apr 28 23:45 scalaprops.ll
-rw-r--r-- 1 kenji 7.4M Apr 28 23:45 __const.ll
-rw-r--r-- 1 kenji 7.2M Apr 28 23:45 __trait_has_trait.ll
-rw-r--r-- 1 kenji 6.9M Apr 28 23:46 scalaz.ll.o
-rw-r--r-- 1 kenji 5.6M Apr 28 23:46 __class_has_trait.ll.o |
No description provided.