1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- var runBenchmarks = require('../support/benchmark-runner');
- var Tokenizer = require('../../index').query.tokenizer;
- var Analyzer = require('../../index').query.analyzer;
- // ╔╗ ╔═╗╔╗╔╔═╗╦ ╦╔╦╗╔═╗╦═╗╦╔═╔═╗
- // ╠╩╗║╣ ║║║║ ╠═╣║║║╠═╣╠╦╝╠╩╗╚═╗
- // ╚═╝╚═╝╝╚╝╚═╝╩ ╩╩ ╩╩ ╩╩╚═╩ ╩╚═╝
- describe('Benchmark :: Analyzer', function() {
- // Set "timeout" and "slow" thresholds incredibly high
- // to avoid running into issues.
- this.slow(240000);
- this.timeout(240000);
- var tokens = {};
- // Tokenize all the test inputs before running benchmarks
- before(function() {
- tokens.select = Tokenizer({
- select: '*',
- from: 'books'
- });
- tokens.insert = Tokenizer({
- insert: {
- title: 'Slaughterhouse Five'
- },
- into: 'books'
- });
- tokens.update = Tokenizer({
- update: {
- status: 'archived'
- },
- where: {
- publishedDate: { '>': 2000 }
- },
- using: 'books'
- });
- tokens.delete = Tokenizer({
- del: true,
- from: 'accounts',
- where: {
- activated: false
- }
- });
- });
- it('should be performant enough', function() {
- runBenchmarks('Analyzer', [
- function analyzeSelectSet() {
- Analyzer(tokens.select);
- },
- function analyzeInsertSet() {
- Analyzer(tokens.insert);
- },
- function analyzeUpdateSet() {
- Analyzer(tokens.update);
- },
- function analyzeDeleteSet() {
- Analyzer(tokens.delete);
- }
- ]);
- });
- });
|