# Performance issue - \[Violation\] 'requestAnimationFrame'

**URL:** <https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260>\
**Category:** p5.js\
**Created:** [April 10, 2021, 12:43pm UTC](https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260 "2021-04-10T12:43:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xbix](https://avatars.discourse-cdn.com/v4/letter/x/ec9cab/32.png) [@xbix](https://discourse.processing.org/u/xbix)\
**Post date:** [April 10, 2021, 12:43pm UTC](https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260/1 "2021-04-10T12:43:00Z")

</div>

In my code, I draw excel data using 2 classes. The CPU load is extremely high and I get this message in the console:

`[Violation] 'requestAnimationFrame' handler took 542ms`

There are no flare messages and when I reduce the drawing to say one line of text, the handler took down to 50ms but the violation message is still displayed.

How can I solve this problem?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 10, 2021, 2:08pm UTC](https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260/2 "2021-04-10T14:08:32Z")

</div>

what do you mean by draw excel data? Can you share the code? If I understand correctly it’s just a warning so you can ignore it.

---

<div class="post-metadata">

**Author:** ![xbix](https://avatars.discourse-cdn.com/v4/letter/x/ec9cab/32.png) [@xbix](https://discourse.processing.org/u/xbix)\
**Post date:** [April 10, 2021, 4:18pm UTC](https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260/3 "2021-04-10T16:18:40Z")

</div>

I am drawing data from a table, but I am not sure if this is really relevant, as the problem already occurs when I do simple drawings, such as rendering a line of text.

I can’t share the code because it’s client data.

I understand it’s only a warning, but the page is extremely slow and the CPU is almost at 100 percent.

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 10, 2021, 4:45pm UTC](https://discourse.processing.org/t/performance-issue-violation-requestanimationframe/29260/4 "2021-04-10T16:45:04Z")

</div>

What I understand is that it’s not that the warning is causing the performance issue but the performance issue is causing the warning.

I can only give high level comments as it’s hard to “solve” the issue from the given information. I would break the code into different parts or comment out some lines to see what is dragging the performance. But, in general, I avoid using p5.js for _production_ code because often the library itself is not optimized as it focuses on learning rather than performance.
