Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Testing bitflag expansion#242

Merged
jsantell merged 1 commit into
mozilla:rustfrom
jsantell:226
Feb 10, 2017
Merged

Testing bitflag expansion#242
jsantell merged 1 commit into
mozilla:rustfrom
jsantell:226

Conversation

@jsantell
Copy link
Copy Markdown
Contributor

@jsantell jsantell commented Feb 3, 2017

Based off of @ncalexan's #214, relevant commit:

a021735

Comment thread db/src/db.rs

// Insert datoms that were added and not already present.
let s = r#"
let s = format!(r#"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is performance benchmarking, so someone should have an eye on this query other than me

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jsantell jsantell requested a review from ncalexan February 3, 2017 20:38
Copy link
Copy Markdown
Member

@ncalexan ncalexan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, just like I expected it to. I have many review changes for #214 so this will need rebasing, but it shouldn't be hard!

Comment thread db/src/db.rs Outdated
const TRUE: &'static bool = &true;
const FALSE: &'static bool = &false;

const INDEX_AVET : u8 = 1 << 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for the final patch, comment on what these are and how the scheme works.

Comment thread db/src/db.rs Outdated
// 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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider implementing Attribute.flags() or similar.

Comment thread db/src/db.rs
.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)))))))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

Comment thread db/src/db.rs

// Insert datoms that were added and not already present.
let s = r#"
let s = format!(r#"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread db/src/db.rs
@@ -518,10 +523,7 @@ impl DB {
value_type_tag0 SMALLINT NOT NULL,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jsantell
Copy link
Copy Markdown
Contributor Author

jsantell commented Feb 9, 2017

@ncalexan rebased on that big PR. For implementing Attribute.flags(), to clarify, are you talking about:

  • Moving BitFlags type to core/src/lib and importing that into db/src/db
  • Provide an Attribute.flags() function that returns a bitfield containing all of the flags (index_vaet, etc) that we want in the bitfield?

@ncalexan
Copy link
Copy Markdown
Member

ncalexan commented Feb 9, 2017

Provide an Attribute.flags() function that returns a bitfield containing all of the flags (index_vaet, etc) that we want in the bitfield?

@jsantell, I was thinking of this.

@jsantell jsantell force-pushed the 226 branch 2 times, most recently from 5dd09b2 to b69d426 Compare February 10, 2017 01:15
@jsantell
Copy link
Copy Markdown
Contributor Author

@ncalexan Ok, made the type changes and flags() helper -- good for review

Copy link
Copy Markdown
Member

@ncalexan ncalexan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread core/src/lib.rs Outdated
pub enum AttributeBitFlags {
IndexAVET = 1 << 0,
IndexVAET = 1 << 1,
IndexFullText = 1 << 2,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think we're considering "fulltext" one word, but I'm not militant about this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And looks like this is the best way to do this according to #rust

Comment thread db/src/db.rs
@@ -55,6 +55,8 @@ pub const CURRENT_VERSION: i32 = 2;
const TRUE: &'static bool = &true;
const FALSE: &'static bool = &false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spurious change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops yeah

Comment thread db/src/db.rs
attribute.value_type == ValueType::Ref,
attribute.fulltext,
attribute.unique_value))
flags))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just inline this call? Your choice, your style.

@ncalexan
Copy link
Copy Markdown
Member

Also, check the tests of all the crates -- Travis is angry :)

…n the datoms table to investigate performance difference. Fixes mozilla#226. r=nalexander
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants