Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/benchmarks.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | void Benchmarks::parser() | 51 | void Benchmarks::parser() | ||
52 | { | 52 | { | ||
53 | QIODevice* file = getInternalFile(); | 53 | QIODevice* file = getInternalFile(); | ||
54 | QBENCHMARK { | 54 | QBENCHMARK { | ||
55 | ParseSession session = ParseSession(); | 55 | ParseSession session = ParseSession(); | ||
56 | session.setContents(file->readAll()); | 56 | session.setContents(file->readAll()); | ||
57 | StartAst* ast = 0; | 57 | StartAst* ast = nullptr; | ||
58 | session.parse(&ast); | 58 | session.parse(&ast); | ||
59 | } | 59 | } | ||
60 | delete file; | 60 | delete file; | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | void Benchmarks::declarationBuilder() | 63 | void Benchmarks::declarationBuilder() | ||
64 | { | 64 | { | ||
65 | QIODevice* file = getInternalFile(); | 65 | QIODevice* file = getInternalFile(); | ||
66 | ParseSession session; | 66 | ParseSession session; | ||
67 | session.setContents(file->readAll()); | 67 | session.setContents(file->readAll()); | ||
68 | delete file; | 68 | delete file; | ||
69 | StartAst* ast = 0; | 69 | StartAst* ast = nullptr; | ||
70 | session.parse(&ast); | 70 | session.parse(&ast); | ||
71 | EditorIntegrator editor(&session); | 71 | EditorIntegrator editor(&session); | ||
72 | QBENCHMARK { | 72 | QBENCHMARK { | ||
73 | DeclarationBuilder builder(&editor); | 73 | DeclarationBuilder builder(&editor); | ||
74 | builder.build(internalFunctionFile(), ast); | 74 | builder.build(internalFunctionFile(), ast); | ||
75 | } | 75 | } | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | void Benchmarks::useBuilder() | 78 | void Benchmarks::useBuilder() | ||
79 | { | 79 | { | ||
80 | const auto document = IndexedString(QUrl(QStringLiteral("file:///internal/BigTestFile.php"))); | 80 | const auto document = IndexedString(QUrl(QStringLiteral("file:///internal/BigTestFile.php"))); | ||
81 | 81 | | |||
82 | QIODevice* file = getInternalFile(); | 82 | QIODevice* file = getInternalFile(); | ||
83 | ParseSession session = ParseSession(); | 83 | ParseSession session = ParseSession(); | ||
84 | session.setCurrentDocument(document); | 84 | session.setCurrentDocument(document); | ||
85 | session.setContents(file->readAll()); | 85 | session.setContents(file->readAll()); | ||
86 | delete file; | 86 | delete file; | ||
87 | 87 | | |||
88 | StartAst* ast = 0; | 88 | StartAst* ast = nullptr; | ||
89 | session.parse(&ast); | 89 | session.parse(&ast); | ||
90 | EditorIntegrator editor(&session); | 90 | EditorIntegrator editor(&session); | ||
91 | DeclarationBuilder builder(&editor); | 91 | DeclarationBuilder builder(&editor); | ||
92 | 92 | | |||
93 | KDevelop::ReferencedTopDUContext chain = builder.build(document, ast); | 93 | KDevelop::ReferencedTopDUContext chain = builder.build(document, ast); | ||
94 | QBENCHMARK { | 94 | QBENCHMARK { | ||
95 | UseBuilder useBuilder(&editor); | 95 | UseBuilder useBuilder(&editor); | ||
96 | useBuilder.buildUses(ast); | 96 | useBuilder.buildUses(ast); | ||
97 | } | 97 | } | ||
98 | } | 98 | } | ||
99 | 99 | | |||
100 | } | 100 | } | ||
101 | 101 | |