-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not create constant pool key eagerly
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each data expression was evaluated. Next step is to also make it not create the MessageDigest over and over again. Part of #7826
- Loading branch information
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...est-root-context/src/main/java/com/vaadin/flow/uitest/ui/ConstantPoolPerformanceView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2000-2021 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.vaadin.flow.uitest.ui; | ||
|
||
import com.vaadin.flow.component.UI; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.component.html.H1; | ||
import com.vaadin.flow.component.html.NativeButton; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@Route("performance/constant-pool") | ||
public class ConstantPoolPerformanceView extends AbstractDivView { | ||
|
||
Div container = new Div(); | ||
Div notification = new Div(); | ||
public ConstantPoolPerformanceView() { | ||
NativeButton btn = new NativeButton("refresh"); | ||
btn.addClickListener(e->{ | ||
container.removeAll(); | ||
for (int i = 0; i <1000; i++) { | ||
container.add(new H1("Headline " + i)); | ||
container.add(new NativeButton("BTN " + i, e2 -> notification.setText("clicked"))); | ||
} | ||
UI.getCurrent().getPage().executeJs("setTimeout(function(){$0.click()},2000)", btn); | ||
}); | ||
add(btn,notification,container); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters