Testing bitflag expansion#242
Conversation
|
|
||
| // Insert datoms that were added and not already present. | ||
| let s = r#" | ||
| let s = format!(r#" |
There was a problem hiding this comment.
This is performance benchmarking, so someone should have an eye on this query other than me
There was a problem hiding this comment.
Yeah, this is early days. We're still deep in the "make it correct" phase, but I was hoping to get some idea of how much this saves. We'll be better able to benchmark as the transactor fleshes out.
| const TRUE: &'static bool = &true; | ||
| const FALSE: &'static bool = &false; | ||
|
|
||
| const INDEX_AVET : u8 = 1 << 0; |
There was a problem hiding this comment.
nit: for the final patch, comment on what these are and how the scheme works.
| // Now we can represent the typed value as an SQL value. | ||
| let (value, value_type_tag): (ToSqlOutput, i32) = typed_value.to_sql_value_pair(); | ||
|
|
||
| let mut flags: u8 = 0; |
There was a problem hiding this comment.
Consider implementing Attribute.flags() or similar.
| .chain(once(to_bool_ref(index_vaet) as &ToSql) | ||
| .chain(once(to_bool_ref(index_fulltext) as &ToSql) | ||
| .chain(once(to_bool_ref(unique_value) as &ToSql)))))))))) | ||
| .chain(once(flags as &ToSql))))))) |
|
|
||
| // Insert datoms that were added and not already present. | ||
| let s = r#" | ||
| let s = format!(r#" |
There was a problem hiding this comment.
Yeah, this is early days. We're still deep in the "make it correct" phase, but I was hoping to get some idea of how much this saves. We'll be better able to benchmark as the transactor fleshes out.
| @@ -518,10 +523,7 @@ impl DB { | |||
| value_type_tag0 SMALLINT NOT NULL, | |||
There was a problem hiding this comment.
These tables definitely deserve a comment about the flag compression. And flags should still be a TINYINT, although this doesn't make much difference in SQLite, IIUC.
|
@ncalexan rebased on that big PR. For implementing
|
@jsantell, I was thinking of this. |
5dd09b2 to
b69d426
Compare
|
@ncalexan Ok, made the type changes and |
ncalexan
left a comment
There was a problem hiding this comment.
This looks good! I assume that you've looked and you can't define an enum -> u8 conversion better than all the as u8 conversions you've done? Might be worth asking for confirmation from jimb or #rust about how to do this best.
But feel free to land and follow-up if you prefer!
| pub enum AttributeBitFlags { | ||
| IndexAVET = 1 << 0, | ||
| IndexVAET = 1 << 1, | ||
| IndexFullText = 1 << 2, |
There was a problem hiding this comment.
nit: I think we're considering "fulltext" one word, but I'm not militant about this.
There was a problem hiding this comment.
And looks like this is the best way to do this according to #rust
| @@ -55,6 +55,8 @@ pub const CURRENT_VERSION: i32 = 2; | |||
| const TRUE: &'static bool = &true; | |||
| const FALSE: &'static bool = &false; | |||
|
|
|||
| attribute.value_type == ValueType::Ref, | ||
| attribute.fulltext, | ||
| attribute.unique_value)) | ||
| flags)) |
There was a problem hiding this comment.
Maybe just inline this call? Your choice, your style.
|
Also, check the tests of all the crates -- Travis is angry :) |
…n the datoms table to investigate performance difference. Fixes mozilla#226. r=nalexander
Based off of @ncalexan's #214, relevant commit:
a021735