# Questions about onPointerObservable

**URL:** <https://forum.babylonjs.com/t/questions-about-onpointerobservable/55330>\
**Category:** Questions\
**Tags:** pointerevents\
**Created:** [December 12, 2024, 4:55pm UTC](https://forum.babylonjs.com/t/questions-about-onpointerobservable/55330 "2024-12-12T16:55:09Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [December 17, 2024, 4:59pm UTC](https://forum.babylonjs.com/t/questions-about-onpointerobservable/55330/11 "2024-12-17T16:59:01Z")

</div>

We finally have the explanation!!

The slow version is slow because with more than 1 million faces the memory cache is not as efficient as the other version.  
Why? Because the slow version has faces dispatched in a random order where the fast version has faces gathered if they share common vertices.

To get rid of that we have introduce a new feature on mesh:

```auto
const terrain = scene.getMeshByName("Terrain");
await terrain.optimizeIndicesAsync();

```

That function will reorganize the indices to maximize cache hit.

PR: [Add a new optimizeIndices features to improve cache hit on large models by deltakosh · Pull Request #16009 · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/pull/16009)

---

_[View the full topic](https://forum.babylonjs.com/t/questions-about-onpointerobservable/55330)._
