Let miniboxing tell you when your code could be improved: -P:minibox:warn


Will miniboxing be merged into Scala?

(back to news articles )

Lately the question of merging the miniboxing plugin into the Scala compiler has arisen in different contexts. We have seen Scala collections miniboxed by hand, and we have even received a suggestion that miniboxing should be an opt-out instead of opt-in, meaning that all type parameters automatically undergo the miniboxing transformation, as if they were annotated with @miniboxed.

We are very glad such questions are asked, as it gives us the opportunity to clarify the roadmap.

So, will the miniboxing plugin be merged into Scala?

Short answer

It depends on you! For now, it will stay a plugin, but the more projects use miniboxing, the more chances it has to become the standard.

Long answer:

Miniboxing is not currently on the Scala roadmap, but we can change that!

The first step for any plugin that changes the compilation pipeline is to become trusted. And to do so, we need projects using it and reporting their experience. We have already tested the Scala linked list with 1.5-4x speedups, the spire library and we will continue trying other use-cases. But there’s a huge number of cool projects that could use the miniboxing transformation and we need your help!

So if you’d like to see miniboxing in Scala:

  1. Start using it as a plugin, no matter how big or small your project is! Rest assured that with 150+ tests running with each commit, there’s little risk that miniboxing will break your code;
  2. Ask questions on the mailing list or via twitter;
  3. Report any errors you encounter on the github issue tracker;
  4. Write about your use-case and submit a pull request for the website (we welcome contributions!);
  5. Help spread the word, so others can use miniboxing too.

If the miniboxing plugin becomes a common sight in Scala project builds, it may be worth merging it into scalac. Then again, having it as a scalac plugin means easier development and quicker fixes, so keeping it a plugin might not a bad solution at all.

To wrap up, miniboxing will stay as a separate compiler plugin at least for the next Scala release. Whether or not it will become part of scalac in the future depends on you!

Will Scala collections be transformed with miniboxing?

We aim to have an alternative set of collections transformed using miniboxing, which map 1:1 with Scala collections. But this is a medium-term goal.

Will miniboxing become opt-out?

YES! We are currently working on a flag that will turn miniboxing on by default. Stay tuned! :)

Comments

Comments are always welcome! But to make the best use of them, please consider this:

Thanks! Looking forward to your messages!


comments powered by Disqus