add console timers for debugging/optimizing (commented)

This commit is contained in:
joshuaboud 2022-06-16 14:07:42 -03:00
parent f2782ae92b
commit 5fe2575c0d
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import { ref, reactive, computed, inject, watch, onBeforeUnmount, onMounted, nextTick } from 'vue'; import { ref, reactive, computed, inject, watch, onBeforeUnmount, onMounted, nextTick, onUnmounted } from 'vue';
import { errorStringHTML } from '@45drives/cockpit-helpers'; import { errorStringHTML } from '@45drives/cockpit-helpers';
import { notificationsInjectionKey, settingsInjectionKey, clipboardInjectionKey } from '../keys'; import { notificationsInjectionKey, settingsInjectionKey, clipboardInjectionKey } from '../keys';
import DirectoryEntry from './DirectoryEntry.vue'; import DirectoryEntry from './DirectoryEntry.vue';
@ -104,6 +104,7 @@ export default {
return; return;
} }
processingHandler.start(); processingHandler.start();
// console.time('getEntries-' + props.path);
try { try {
const cwd = props.path; const cwd = props.path;
const tmpEntries = ( const tmpEntries = (
@ -111,7 +112,7 @@ export default {
cwd, cwd,
props.host, props.host,
[], [],
(message) => notifications.value.constructNotification("Failed to parse file name", message, 'error') (message) => notifications.value.constructNotification("Error getting files", message, 'error')
) )
); );
if (props.path !== cwd) { if (props.path !== cwd) {
@ -129,6 +130,7 @@ export default {
notifications.value.constructNotification("Error getting directory entries", errorStringHTML(error), 'error'); notifications.value.constructNotification("Error getting directory entries", errorStringHTML(error), 'error');
emit('cancelShowEntries'); emit('cancelShowEntries');
} finally { } finally {
// console.timeEnd('getEntries-' + props.path);
processingHandler.stop(); processingHandler.stop();
} }
} }
@ -216,13 +218,18 @@ export default {
onBeforeUnmount(() => { onBeforeUnmount(() => {
processingHandler.resolveDangling(); processingHandler.resolveDangling();
fileSystemWatcher.stop(); fileSystemWatcher.stop();
// console.time('unmount-' + props.path);
}); });
// onUnmounted(() => console.timeEnd('unmount-' + props.path));
watch(() => props.sortCallback, sortEntries); watch(() => props.sortCallback, sortEntries);
watch(() => settings.directoryView?.separateDirs, sortEntries); watch(() => settings.directoryView?.separateDirs, sortEntries);
watch([entries, () => settings?.directoryView?.showHidden, () => props.searchFilterRegExp], () => { watch([entries, () => settings?.directoryView?.showHidden, () => props.searchFilterRegExp], () => {
// console.time('updateVisibleEntries-' + props.path);
visibleEntries.value = entries.value.filter(entryFilterCallback); visibleEntries.value = entries.value.filter(entryFilterCallback);
// nextTick(() => console.timeEnd('updateVisibleEntries-' + props.path));
const _stats = visibleEntries.value.reduce((_stats, entry) => { const _stats = visibleEntries.value.reduce((_stats, entry) => {
if (entry.type === 'd' || (entry.type === 'l' && entry.target?.type === 'd')) if (entry.type === 'd' || (entry.type === 'l' && entry.target?.type === 'd'))
_stats.dirs++; _stats.dirs++;