3 ms·
As far as I know, Truffle is able to do some absolutely incredible compile-time optimizations —- reaching deeply into what we would normally regard as strictly
by TimTheTinker 6y ago
As far as I know, Truffle is able to do some absolutely incredible compile-time optimizations —- reaching deeply into what we would normally regard as strictly semantic territory.
(For an example, see some of the optimizations done by TruffleRuby for things like `myArray.sort.first` - which it apparently optimizes by terminating the sort as soon as the first element is sorted to the front of the array... and all that without any special hints in the standard library. Please correct me if I’m wrong... it’s been a few years since I’ve read in depth about TruffleRuby. And granted this example isn’t Java, but I imagine there are great parallels there.)
- deleted 6y ago[deleted]
- tosh 6y agoI'm not sure how it would terminate sort early, my initial assumption was that for small arrays there might be special-casing? this seems to be a related thread on twitter: https://twitter.com/ChrisGSeaton/status/1001582169578524672 https://twitter.com/ChrisGSeaton/status/1001582169578524672
- monadic2 6y agoAre you unsure about the runtime considerations or how the compiler would infer the necessary optimizations?
- innagadadavida 6y agoCan the storage of generic containers change as well? For example, store the objects in the container instead of reference?