Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Optional yieldIfContendedSafely() on bulkInsert #54

Merged
merged 4 commits into from Jun 2, 2015
Merged

Conversation

Electryc
Copy link
Contributor

@Electryc Electryc commented Jun 2, 2015

Allowing to specify an optional query parameter for allowing or not yieldIfContendedSafely() during bulk inserts.

The reasoning behind not wanting the yield is that in case of parallel multithreaded bulkInserts the yield will case ending and starting new transactions and thread context switching in turn causing performance issues.

In order to keep backwards compatibility and for a more flexible API, we didn't removed the yield completely, but rather let the user choose. By default, the bulkInsert will yield.

Notice the major increase of performance when not using yield:

bluk_yield

@blundell
Copy link
Contributor

blundell commented Jun 2, 2015

Add the useage to the demo module

@Electryc
Copy link
Contributor Author

Electryc commented Jun 2, 2015

@blundell 👍 6152aa6

@blundell
Copy link
Contributor

blundell commented Jun 2, 2015

I more imagined you would create a new page in the demo that does a yield. Then you can write why you are using yield in that scenario. Not just change the other demo's :-(

@@ -23,10 +24,14 @@ public void bulkSaveDataToFireworksTable(ContentValues[] values) {
}

private void bulkSaveDataToTable(String table, ContentValues[] values) {
Uri uri = createUri(table);
Uri uri = createUriWithoutYieldFor(table);
Copy link
Contributor

Choose a reason for hiding this comment

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

wohoo 👍

@Electryc
Copy link
Contributor Author

Electryc commented Jun 2, 2015

All right, I'll provide an example with both yield and without it in order to compare the multithreaded bulkInsert in terms of duration 👍

@Electryc Electryc closed this Jun 2, 2015
@blundell
Copy link
Contributor

blundell commented Jun 2, 2015

👍 when I said "write what it means" I meant in a textview in the demo, so the peeps using it can read it there n then

@Electryc Electryc reopened this Jun 2, 2015
@Electryc
Copy link
Contributor Author

Electryc commented Jun 2, 2015

@blundell added an example in the sample module where the difference between yield and not yield can be clearly seen.

@blundell
Copy link
Contributor

blundell commented Jun 2, 2015

nice i assume the edittexts have hints to know which is which

blundell added a commit that referenced this pull request Jun 2, 2015
Optional yieldIfContendedSafely() on bulkInsert
@blundell blundell merged commit 7e8eb02 into master Jun 2, 2015
@blundell blundell deleted the optional_yield branch June 2, 2015 16:27
@Electryc
Copy link
Contributor Author

Electryc commented Jun 2, 2015

@blundell yep

Firework firework = data.get(0);
return TextUtils.replace(
DatabaseConstants.RawSql.BULK_INSERT_FIREWORKS,
new String[]{"Times", "Na", "Co", "No", "Ft", "Pr", "Sh"},
Copy link
Contributor

Choose a reason for hiding this comment

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

your input data offends me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not really input data, there are just placeholders to be replaced with the computed sql for the users of the demo to see what sql has been executed. Just following the other screens examples 👅

Copy link
Contributor

Choose a reason for hiding this comment

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

other demo's are amazing soooo 👍

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.

None yet

3 participants