primeng icon indicating copy to clipboard operation
primeng copied to clipboard

DatePicker performance regression from v20 to v21

Open lukedays opened this issue 11 months ago • 7 comments

Describe the bug

There is a significant performance regression in the DatePicker component when upgrading from PrimeNG v20 to v21. Rendering multiple DatePicker instances is noticeably slower in v21.

Pull Request Link

No response

Reason for not contributing a PR

  • [x] Lack of time
  • [x] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/~/github.com/lukedays/primeng-datepicker-v20

Environment

Windows 11, Chrome 143

Angular version

21.0.2

PrimeNG version

v21

Node version

24.11.1

Browser(s)

Chrome 143

Steps to reproduce the behavior

PrimeNG/Angular 20 (baseline)

  1. Clone the Angular 20 version: https://stackblitz.com/~/github.com/lukedays/primeng-datepicker-v20
  2. Run npm install
  3. Run npm test
  4. Observe the rendering time in the console

PrimeNG/Angular 21 (performance issue)

  1. Clone the Angular 21 version: https://stackblitz.com/~/github.com/lukedays/primeng-datepicker-v21
  2. Run npm install
  3. Run npm test
  4. Compare the rendering time with Angular 20

Note: I couldn't make the Angular 21 version work on StackBlitz due to LMDB compatibility.

Expected behavior

The DatePicker component should render with similar performance in both Angular 20 and Angular 21. The rendering time should not significantly increase between versions.

lukedays avatar Dec 17 '25 02:12 lukedays

+1 Have a table using 2 Datepickers on each row and render times have gone from ~1 seconds to 5 seconds now using virtual scroll showing 20 at a time without changing anything except for upgrading to ngprime21.

Caleb13360 avatar Dec 31 '25 04:12 Caleb13360

I noticed the same issue after updating to version 21 DatePicker rendering has become much slower.

vvgrad avatar Jan 05 '26 19:01 vvgrad

Yupp, I'm having the same issue, that rendering a component with datepickers is very slow...

be-ndee avatar Jan 29 '26 10:01 be-ndee

+1

We've noticed the same issue after upgrading to v21.

salimmenari avatar Feb 06 '26 10:02 salimmenari

Hello! Any news on this? Thanks in advance.

lukedays avatar Mar 17 '26 22:03 lukedays

+1 Have a table using 2 Datepickers on each row and render times have gone from ~1 seconds to 5 seconds now using virtual scroll showing 20 at a time without changing anything except for upgrading to ngprime21.

I have exactly same scenario, Rendering 250 rows with two datepickers each takes about 10 seconds. When replaced with native html5 datepicker about 2 seconds. Accidentally tracked it down to primeng.

alekw avatar Apr 19 '26 19:04 alekw

It looks like the full calendar view is rendered when the datepicker is initialized, then immediately removed from the DOM until it is actually shown by the user. In my tests the initial calendar renders 3 times per datepicker.

I found a workaround that avoids rendering the calendar by setting the property timeOnly to true, and changing it to false onShow. This probably helps because the timeonly-form is lighter.

<p-datepicker [timeOnly]="timeonly()"
					              (onFocus)="timeonly.set(false)"
					              (onShow)="timeonly.set(false)"/>

jonlarsson avatar Apr 27 '26 13:04 jonlarsson