# Profiling help for slow html5

**URL:** <https://forum.defold.com/t/profiling-help-for-slow-html5/72332>\
**Category:** Questions\
**Created:** [January 2, 2023, 2:30pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332 "2023-01-02T14:30:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DipFlip](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dipflip/32/23970_2.png) [@DipFlip](https://forum.defold.com/u/DipFlip)\
**Post date:** [January 2, 2023, 2:30pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/1 "2023-01-02T14:30:36Z")

</div>

My html5 game runs very poorly on a few select devices and great on most. I’m trying to pin what the culprit is. Attached is a screenshot from chrome when the game is running at a very low frame-rate. How can I track down more about this getError that takes a lot of time?

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/0/7/073920fd2b27413d655dd196d590197debdcacff.png)

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/4/f/4f46e2df2bd1de7af1d890136d9e80ab205bfef6.png)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 2, 2023, 2:58pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/2 "2023-01-02T14:58:48Z")

</div>

I believe this is caused by error checks on all graphics calls. This should be disabled by default. Check your game.project file in HTML5 Engine Arguments and verify that it has `--verify-graphics-calls=false`.

 ![Screenshot 2023-01-02 at 15.57.13](https://forum-defold-uploads.b-cdn.net/original/3X/2/e/2e5a973d068fb2a3277b7791f23ee20ac8e548c7.png)

---

<div class="post-metadata">

**Author:** ![DipFlip](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dipflip/32/23970_2.png) [@DipFlip](https://forum.defold.com/u/DipFlip)\
**Post date:** [January 2, 2023, 3:07pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/3 "2023-01-02T15:07:08Z")

</div>

Thanks. It is already disabled like that.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 2, 2023, 8:47pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/4 "2023-01-02T20:47:25Z")

</div>

Hmm, ok, are you using a custom index.html?

---

<div class="post-metadata">

**Author:** ![DipFlip](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dipflip/32/23970_2.png) [@DipFlip](https://forum.defold.com/u/DipFlip)\
**Post date:** [January 3, 2023, 10:21am UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/5 "2023-01-03T10:21:11Z")

</div>

Yes I do and testing without it removes the error! Does the custom index.html not respect `--verify-graphics-calls=false` or does it point to me having a different error in the custom html?

Perhaps a different question but on a more general term, the game without the custom index.html still has a pretty low frame-rate. Can I track what’s the next-most time consuming activity (see below)?

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/7/5/751e253a9fe6d92b644e2aeaff389db1742adfb0.png)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 3, 2023, 10:29am UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/6 "2023-01-03T10:29:02Z")

</div>

> [@DipFlip](#):
>
> Does the custom index.html not respect `--verify-graphics-calls=false` or does it point to me having a different error in the custom html?

It seems like yours doesn’t. If you open engine\_template.html from /builtins/manifests/web you find that this is a templated file where some values get replaced before writing the final file to the bundle location. In the engine\_template.html there is:

```lua
	<script id='engine-setup' type='text/javascript'>
	var extra_params = {
		archive_location_filter: function( path ) {
			return ("{{DEFOLD_ARCHIVE_LOCATION_PREFIX}}" + path + "{{DEFOLD_ARCHIVE_LOCATION_SUFFIX}}");
		},
		engine_arguments: [{{#DEFOLD_ENGINE_ARGUMENTS}}"{{.}}",{{/DEFOLD_ENGINE_ARGUMENTS}}],
		custom_heap_size: {{DEFOLD_HEAP_SIZE}},
		full_screen_container: "#canvas-container",
		disable_context_menu: true
	}

```

As you can see the `{{#DEFOLD_ENGINE_ARGUMENTS}}"{{.}}",{{/DEFOLD_ENGINE_ARGUMENTS}}` will get replaced by whatever value you have in game.project HTML5 Engine Arguments field.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 3, 2023, 10:31am UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/7 "2023-01-03T10:31:25Z")

</div>

> [@DipFlip](#):
>
> Perhaps a different question but on a more general term, the game without the custom index.html still has a pretty low frame-rate. Can I track what’s the next-most time consuming activity (see below)?

You should start checking your Lua code for clues. The web developer tools will not give you any real information about the code being run. Do you run a lot of code in `update()` functions? Also, use the profiler to learn where the engine spends most of the time.

> **[Profiling in Defold](https://defold.com/manuals/profiling/)**
>
> This manual explains the profiling facilities present in Defold.

---

<div class="post-metadata">

**Author:** ![DipFlip](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dipflip/32/23970_2.png) [@DipFlip](https://forum.defold.com/u/DipFlip)\
**Post date:** [January 3, 2023, 2:50pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/8 "2023-01-03T14:50:34Z")

</div>

Thanks for the help! I put the missing bits back into my custom index.html and played around with the profiler some. I’m getting about 20 draw calls which sounds many perhaps? I have multiple gradient textures I use to fade all/parts of the screen which is probably why.

The biggest difference I found though was to uncheck `High Dpi` under `game.project/Display`. With the option unchecked, the devices that run at low FPS before run as smoothly as other devices.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 3, 2023, 9:12pm UTC](https://forum.defold.com/t/profiling-help-for-slow-html5/72332/9 "2023-01-03T21:12:30Z")

</div>

> [@DipFlip](#):
>
> I’m getting about 20 draw calls which sounds many perhaps?

That’s not much, even for html5, but on a low end device it could be a problem. Try to reduce draw calls if you can.

> [@DipFlip](#):
>
> The biggest difference I found though was to uncheck `High Dpi` under `game.project/Display`. With the option unchecked, the devices that run at low FPS before run as smoothly as other devices.

Makes sense. You only have to deal with 25% of the pixels with high dpi disabled.
