couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1130) binary optimization in couch_file
Date Mon, 18 Apr 2011 22:45:05 GMT


Paul Joseph Davis commented on COUCHDB-1130:

I'm not entirely certain about the match contexts as this is the first I've heard of them.
I *think* we're getting away with sub binaries here though.

The part about match contexts though doesn't worry me as we're only adding one for every 4K
of data we read.

I would point out that this isn't only being hit for reads longer than 4K, this will affect
any read that crosses a 4K boundary which could be often enough to make a difference.

> binary optimization in couch_file
> ---------------------------------
>                 Key: COUCHDB-1130
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: Database Core
>    Affects Versions: 1.0.2
>            Reporter: Randall Leeds
>            Priority: Minor
>         Attachments: 0001-refactor-remove_block_prefixes-2-for-optimization.patch
> I've had this patch sitting around since January and kept forgetting to file the ticket.
Hurray spring cleaning.
> Just for fun I ran erlc with +bin_opt_info, which gives information about how the Erlang
VM can optimize creating binary objects.
> What follows is the commit message from my patch.
> Even if I'm wrong about the last point, it can't hurt.
> What think you all?
> -------------------
> Running erlc with +bin_opt_info gives an INFO message stating that "matching
> anything else but a plain variable to the left of a binary pattern will prevent
> delayed sub binary optimization; SUGGEST changing argument order"
> I guess matching 0 is triggering this. If I understand correctly, this change
> will allow the compiler to skip creating a sub-binary that starts at the block
> boundary in the third clause and delay creation until we strip the leading byte
> in the 0 clause. This means one less 1-byte binary every time we read across a
> block boundary.

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message