Commit 101a0140 authored by Denys Mishunov's avatar Denys Mishunov

Performance measurement for Snippet Edit view

parent fca4ba9e
<script> <script>
import { initEditorLite } from '~/blob/utils'; import { initEditorLite } from '~/blob/utils';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import {
SNIPPET_MARK_BLOB_CONTENT,
SNIPPET_MARK_EDIT_APP_START,
SNIPPET_MEASURE_BLOB_CONTENT,
SNIPPET_MEASURE_BLOB_CONTENT_WITHIN_APP,
} from '~/performance_constants';
export default { export default {
props: { props: {
...@@ -31,6 +37,11 @@ export default { ...@@ -31,6 +37,11 @@ export default {
blobPath: this.fileName, blobPath: this.fileName,
blobContent: this.value, blobContent: this.value,
}); });
window.requestAnimationFrame(() => {
performance.mark(SNIPPET_MARK_BLOB_CONTENT);
performance.measure(SNIPPET_MEASURE_BLOB_CONTENT);
performance.measure(SNIPPET_MEASURE_BLOB_CONTENT_WITHIN_APP, SNIPPET_MARK_EDIT_APP_START);
});
}, },
methods: { methods: {
triggerFileChange: debounce(function debouncedFileChange() { triggerFileChange: debounce(function debouncedFileChange() {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// marks // marks
export const SNIPPET_MARK_VIEW_APP_START = 'snippet-view-app-start'; export const SNIPPET_MARK_VIEW_APP_START = 'snippet-view-app-start';
export const SNIPPET_MARK_EDIT_APP_START = 'snippet-edit-app-start';
export const SNIPPET_MARK_BLOB_CONTENT = 'snippet-blob-content-finished'; export const SNIPPET_MARK_BLOB_CONTENT = 'snippet-blob-content-finished';
// Measures // Measures
......
...@@ -21,6 +21,7 @@ import { ...@@ -21,6 +21,7 @@ import {
import SnippetBlobEdit from './snippet_blob_edit.vue'; import SnippetBlobEdit from './snippet_blob_edit.vue';
import SnippetVisibilityEdit from './snippet_visibility_edit.vue'; import SnippetVisibilityEdit from './snippet_visibility_edit.vue';
import SnippetDescriptionEdit from './snippet_description_edit.vue'; import SnippetDescriptionEdit from './snippet_description_edit.vue';
import { SNIPPET_MARK_EDIT_APP_START } from '~/performance_constants';
export default { export default {
components: { components: {
...@@ -106,6 +107,9 @@ export default { ...@@ -106,6 +107,9 @@ export default {
return `${this.isProjectSnippet ? 'project' : 'personal'}_snippet_description`; return `${this.isProjectSnippet ? 'project' : 'personal'}_snippet_description`;
}, },
}, },
beforeCreate() {
performance.mark(SNIPPET_MARK_EDIT_APP_START);
},
created() { created() {
window.addEventListener('beforeunload', this.onBeforeUnload); window.addEventListener('beforeunload', this.onBeforeUnload);
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment