Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(865)

Side by Side Diff: chrome/test/data/indexeddb/perf_test.js

Issue 344683002: Deleted testSporadicWrites IndexedDB performance test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed reference to sporadic writes from test description Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/perf/benchmarks/indexeddb_perf.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var overallTestStartTime = window.performance.now(); 5 var overallTestStartTime = window.performance.now();
6 var kUseIndex = true; 6 var kUseIndex = true;
7 var kDontUseIndex = false; 7 var kDontUseIndex = false;
8 var kReadKeysOnly = true; 8 var kReadKeysOnly = true;
9 var kReadDataToo = false; 9 var kReadDataToo = false;
10 var kWriteToo = true; 10 var kWriteToo = true;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Read a sequence of an object store via a cursor, writing 62 // Read a sequence of an object store via a cursor, writing
63 // transformed values into another. 63 // transformed values into another.
64 [testCursorReadsAndRandomWrites, kReadDataToo, kDontUseIndex, kWriteToo, 64 [testCursorReadsAndRandomWrites, kReadDataToo, kDontUseIndex, kWriteToo,
65 kWriteSameStore], 65 kWriteSameStore],
66 // Read a sequence of an index into an object store via a cursor. 66 // Read a sequence of an index into an object store via a cursor.
67 [testCursorReadsAndRandomWrites, kReadDataToo, kUseIndex, kDontWrite, 67 [testCursorReadsAndRandomWrites, kReadDataToo, kUseIndex, kDontWrite,
68 kPlaceholderArg], 68 kPlaceholderArg],
69 // Read a sequence of an index into an object store via a key cursor. 69 // Read a sequence of an index into an object store via a key cursor.
70 [testCursorReadsAndRandomWrites, kReadKeysOnly, kUseIndex, kDontWrite, 70 [testCursorReadsAndRandomWrites, kReadKeysOnly, kUseIndex, kDontWrite,
71 kPlaceholderArg], 71 kPlaceholderArg],
72 // Make batches of random writes into a store, triggered by periodic setTimeout
73 // calls.
74 [testSporadicWrites, 5, 0, kDontRead],
75 // Make large batches of random writes into a store, triggered by periodic
76 // setTimeout calls.
77 [testSporadicWrites, 50, 0, kDontRead],
78 // Make batches of random writes into a store with many indices, triggered by
79 // periodic setTimeout calls.
80 [testSporadicWrites, 5, 10, kDontRead],
81 // Make large batches of random writes into a store with many indices, triggered
82 // by periodic setTimeout calls.
83 [testSporadicWrites, 50, 10, kDontRead],
84 // Make batches of random writes into a store, triggered by periodic setTimeout
85 // calls. Intersperse read transactions to test read-write lock conflicts.
86 [testSporadicWrites, 5, 0, kAlternateWithReads],
87 // Make large batches of random writes into a store, triggered by periodic
88 // setTimeout calls. Intersperse read transactions to test read-write lock
89 // conflicts.
90 [testSporadicWrites, 50, 0, kAlternateWithReads],
91 // Make a small bunch of batches of reads of the same keys from an object store. 72 // Make a small bunch of batches of reads of the same keys from an object store.
92 [testReadCache, 10, kDontUseIndex], 73 [testReadCache, 10, kDontUseIndex],
93 // Make a bunch of batches of reads of the same keys from an index. 74 // Make a bunch of batches of reads of the same keys from an index.
94 [testReadCache, 50, kUseIndex], 75 [testReadCache, 50, kUseIndex],
95 // Make a small bunch of batches of reads of the same keys from an object store. 76 // Make a small bunch of batches of reads of the same keys from an object store.
96 [testReadCache, 10, kDontUseIndex], 77 [testReadCache, 10, kDontUseIndex],
97 // Make a bunch of batches of reads of the same keys from an index. 78 // Make a bunch of batches of reads of the same keys from an index.
98 [testReadCache, 50, kUseIndex], 79 [testReadCache, 50, kUseIndex],
99 // Create and delete an index on a store that already contains data [produces 80 // Create and delete an index on a store that already contains data [produces
100 // a timing result for each of creation and deletion]. 81 // a timing result for each of creation and deletion].
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 mode = "readwrite"; 422 mode = "readwrite";
442 var transaction = 423 var transaction =
443 getTransaction(db, objectStoreNames, mode, completionFunc); 424 getTransaction(db, objectStoreNames, mode, completionFunc);
444 425
445 getValuesFromCursor( 426 getValuesFromCursor(
446 transaction, objectStoreNames[0], numReadsPerTransaction, numKeys, 427 transaction, objectStoreNames[0], numReadsPerTransaction, numKeys,
447 indexName, getKeyForRead, readKeysOnly, outputStoreName); 428 indexName, getKeyForRead, readKeysOnly, outputStoreName);
448 } 429 }
449 } 430 }
450 431
451 function testSporadicWrites(
452 numOperationsPerTransaction, numIndices, alternateWithReads,
453 onTestComplete) {
454 var numKeys = 1000;
455 // With 30 transactions, spaced 50ms apart, we'll need at least 1.5s.
456 var numTransactions = 30;
457 if (alternateWithReads)
458 numTransactions *= 2;
459 var delayBetweenBatches = 50;
460 var indexName;
461 var testName = getDisplayName(arguments);
462 var numTransactionsLeft = numTransactions;
463 var objectStoreNames = ["store"];
464 var numTransactionsRunning = 0;
465
466 var getValue = getSimpleValue;
467 if (numIndices)
468 getValue = function (i) { return getNFieldObjectValue(i, numIndices); };
469
470 automation.setStatus("Creating database.");
471 var options = [];
472 for (var i=0; i < numIndices; ++i) {
473 var o = {};
474 o.indexName = "index " + i;
475 o.indexKeyPath = getNFieldName(i);
476 o.indexIsUnique = false;
477 o.indexIsMultiEntry = false;
478 options.push(o);
479 }
480 createDatabase(testName, objectStoreNames, onCreated, onError, options);
481
482 function onCreated(db) {
483 automation.setStatus("Setting up test database.");
484 var transaction = getTransaction(db, objectStoreNames, "readwrite",
485 function() { onSetupComplete(db); });
486 putLinearValues(transaction, objectStoreNames, numKeys, getSimpleKey,
487 getValue);
488 }
489 var completionFunc;
490 function onSetupComplete(db) {
491 automation.setStatus("Setup complete.");
492 completionFunc =
493 getCompletionFunc(db, testName, window.performance.now(),
494 onTestComplete);
495 runOneBatch(db);
496 }
497
498 function runOneBatch(db) {
499 assert(numTransactionsLeft);
500 if (--numTransactionsLeft) {
501 setTimeout(function () { runOneBatch(db); }, delayBetweenBatches);
502 }
503
504 var mode, transaction;
505 if (alternateWithReads) {
506 ++numTransactionsRunning;
507 transaction =
508 getTransaction(db, objectStoreNames, "readonly", batchComplete);
509 getRandomValues(transaction, objectStoreNames,
510 numOperationsPerTransaction, numKeys);
511 }
512 ++numTransactionsRunning;
513 transaction =
514 getTransaction(db, objectStoreNames, "readwrite", batchComplete);
515 putRandomValues(transaction, objectStoreNames, numOperationsPerTransaction,
516 numKeys);
517
518 function batchComplete() {
519 assert(numTransactionsRunning);
520 if (!--numTransactionsRunning && !numTransactionsLeft)
521 completionFunc();
522 }
523 }
524 }
525
526 function testWalkingMultipleCursors(numCursors, onTestComplete) { 432 function testWalkingMultipleCursors(numCursors, onTestComplete) {
527 var numKeys = 1000; 433 var numKeys = 1000;
528 var numHitsPerKey = 10; 434 var numHitsPerKey = 10;
529 var testName = getDisplayName(arguments); 435 var testName = getDisplayName(arguments);
530 var objectStoreNames = ["input store"]; 436 var objectStoreNames = ["input store"];
531 var indexName = "index name"; 437 var indexName = "index name";
532 var getKey = getSimpleKey; 438 var getKey = getSimpleKey;
533 var getValue = getIndexableValue; 439 var getValue = getIndexableValue;
534 440
535 automation.setStatus("Creating database."); 441 automation.setStatus("Creating database.");
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 request.onerror = onError; 579 request.onerror = onError;
674 request.onsuccess = function() { 580 request.onsuccess = function() {
675 var cursor = request.result; 581 var cursor = request.result;
676 if (cursor && first) { 582 if (cursor && first) {
677 first = false; 583 first = false;
678 cursor.continue(getKey(numKeys - 1)); 584 cursor.continue(getKey(numKeys - 1));
679 } 585 }
680 }; 586 };
681 } 587 }
682 } 588 }
OLDNEW
« no previous file with comments | « no previous file | tools/perf/benchmarks/indexeddb_perf.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698