You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/09 01:27:48 UTC
[GitHub] jaydoane opened a new pull request #1215: Introduce bin_opt_info erl_opts compilation option
jaydoane opened a new pull request #1215: Introduce bin_opt_info erl_opts compilation option
URL: https://github.com/apache/couchdb/pull/1215
<!-- Thank you for your contribution!
Please file this form by replacing the Markdown comments
with your text. If a section needs no action - remove it.
Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
of code collaboration. Positive feedback is represented +1 from committers
and negative is a -1. The -1 also means veto, and needs to be addressed
to proceed. Once there are no objections, the PR can be merged by a
CouchDB committer.
See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
## Overview
<!-- Please give a short brief for the pull request,
what problem it solves or how it makes things better. -->
As discussed in
http://erlang.org/doc/efficiency_guide/binaryhandling.html, the
bin_opt_info option can have the compiler print information about
binary optimizations. Typically, it issues warnings about code that
can not be optimized. For example, with the option enabled, it warns
about this line of code (among many others) like this:
```
src/chttpd/src/chttpd_auth_cache.erl:183: Warning: NOT OPTIMIZED: sub binary is used or returned
```
Not only should having this option enabled draw awareness to existing
sub-optimal binary constructs, it should help developers avoid
creating new ones.
## Testing recommendations
<!-- Describe how we can test your changes.
Does it provides any behaviour that the end users
could notice? -->
This is a compiler configuration change, so test it by running `make clean && make`. You should now see numerous warnings about failed binary optimizations such as
```
/Users/jay/proj/couchdb/src/couch_replicator/src/couch_replicator_api_wrap.erl:401: Warning: INFO: matching anything else but a plain variable to the left of binary pattern will prevent delayed sub binary optimization; SUGGEST changing argument order
/Users/jay/proj/couchdb/src/couch_replicator/src/couch_replicator_api_wrap.erl:1019: Warning: NOT OPTIMIZED: sub binary is used or returned
```
## Related Issues or Pull Requests
<!-- If your changes affects multiple components in different
repositories please put links to those issues or pull requests here. -->
## Checklist
- [x] Code is written and works correctly;
- [ ] Changes are covered by tests;
- [ ] Documentation reflects the changes;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services