# تحسين FCP/LCP عن طريق تخزين عمليات البحث عن وحدات raw-view مؤقتًا

**URL:** <https://meta.discourse.org/t/optimizing-fcp-lcp-by-caching-raw-view-module-lookups/213759>\
**Category:** Development\
**Created:** [3 يناير 2022، 9:41م UTC](https://meta.discourse.org/t/optimizing-fcp-lcp-by-caching-raw-view-module-lookups/213759 "2022-01-03T21:41:03Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![rrit](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rrit](https://meta.discourse.org/u/rrit)\
**Post date:** [4 يناير 2022، 2:51م UTC](https://meta.discourse.org/t/optimizing-fcp-lcp-by-caching-raw-view-module-lookups/213759/5 "2022-01-04T14:51:41Z")

</div>

## lookupView-patch

تم التنفيذ الآن عبر `Map` بدلاً من `Array`.

الوقت المستغرق في بدء تشغيل التطبيق في lookupView - لمثيل التطوير:

- بدون تصحيح: **124 مللي ثانية**  
[Firefox Profiler](https://share.firefox.dev/3qKfEBX) (مكدس الاستدعاءات مصفى إلى `lookupView`)

- مع التصحيح: **9 مللي ثانية**  
[Firefox Profiler](https://share.firefox.dev/3F5YqEx) (مكدس الاستدعاءات مصفى إلى `lookupView`)

الوقت الموفر: **~115 مللي ثانية**

هذا يقلل الوقت المستغرق داخل `appendOutletView` من 1.083 مللي ثانية إلى 946 مللي ثانية - لمثيل التطوير.

* * *

## تصحيح على مساعدي handlebars الخام

نعم، إنها في الواقع نسخة ولصق مع تغيير واحد: استخدم فحصًا غير مكلف لـ `isPath`.

```php
      // يستبدل @ember/-internals/utils isPath
      // @see: https://github.com/emberjs/ember.js/blob/3537670c14883346e11e841fcb71333384fcbc87/packages/%40ember/-internals/metal/lib/path_cache.ts#L5-L7
      // @see: https://github.com/emberjs/ember.js/blob/255a0dd3c7de1187f4a2f61a97cf78bfff8f66a8/packages/%40ember/-internals/glimmer/lib/utils/bindings.ts#L70
      let isPath = context.indexOf('.') > -1;

```

على سبيل المثال، يؤدي `renderTopicListItem` في النهاية إلى العديد من استدعاءات `_getPath` (لتوفير 50-100 مللي ثانية أخرى):  
[Firefox Profiler](https://share.firefox.dev/3HwIkFq) (مكدس الاستدعاءات مصفى إلى `_getPath` داخل `renderTopicListItem`)

ربما تكون الاستدعاءات المكلفة لـ `_getPath` شيئًا يجب تحسينه في _Ember.js_ وليس في _Discourse_.

* * *

وتفقد Firefox Profiler للحصول على رؤى حول تنفيذ JavaScript:

> **[Firefox Profiler - Documentation](https://profiler.firefox.com/docs/)**
>
> Documentation related to the Firefox Profiler, a tool to record and visualize profile.

---

_[View the full topic](https://meta.discourse.org/t/optimizing-fcp-lcp-by-caching-raw-view-module-lookups/213759)._
