Comments (11)
Reported by jayashri
from javaserverfaces-spec.
@edburns said:
The current impl is as fast as it can be given the best efforts of the
RI team and Adam to date.
Where is the bottleneck? It's in
UIComponentBase.getPropertyDescriptor(). This is called whenever
someone accesses a attribute or property on the UIComponent instance.
UIComponentBase.getAttributes().get(). This boils down to a get() on
a WeakHashMap that will return a PropertyDescriptor. This solution
assumes it is safe to have concurrent reads on the WeakHashMap. Is
the a safe assumption?
Is there a faster implementation? If not, can we design it
differently, while preserving backwards compatibility?
We need an automated test that reproduces this bug.
from javaserverfaces-spec.
@edburns said:
I've heard that this may be faster in JDK 1.4, and I would guess it might be
faster still in JDK 5.0?
from javaserverfaces-spec.
@edburns said:
This change-bundle fixes an unsafe assumption about the thread-safety of
unmodified WeakHashMap instances for concurrent reads.
SECTION: API Changes
M jsf-api/src/javax/faces/component/UIComponentBase.java
-
make pdMap ivar a Map, not a WeakHashMap
-
make pdMap ivar be vended by Collections.synchronizedMap().
SECTION: RI changes
M
jsf-ri/systest-per-webapp/el-performance/src/java/com/sun/faces/systest/EvaluatorBean.java
- only wait for between 1 and 100 nanoseconds between get() operations.
SECTION: API Diffs
Index: jsf-api/src/javax/faces/component/UIComponentBase.java
RCS file:
/cvs/javaserverfaces-sources/jsf-api/src/javax/faces/component/UIComponentBase.java,v
retrieving revision 1.101
diff -u -r1.101 UIComponentBase.java
— jsf-api/src/javax/faces/component/UIComponentBase.java 16 Jun 2004
00:06:55 -0000 1.101
+++ jsf-api/src/javax/faces/component/UIComponentBase.java 15 Oct 2004 05:46:30
-0000
@@ -20,6 +20,7 @@
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -75,7 +76,7 @@
-
Reference to the map of
PropertyDescriptor
s for this class -
in the
descriptors
Map
.
*/ -
private WeakHashMap pdMap = null;
- private Map pdMap = null;
/**
-
An empty argument list to be passed to reflection methods.
@@ -84,14 +85,14 @@
public UIComponentBase() {
synchronized(descriptors) {
-
pdMap = (WeakHashMap) descriptors.get(this.getClass());
- pdMap = (Map) descriptors.get(this.getClass());
if (pdMap != null) { return; }
// load the property descriptors for this class.
PropertyDescriptor pd[] = getPropertyDescriptors();
if (pd != null) {
-
pdMap = new WeakHashMap(pd.length);
- pdMap = Collections.synchronizedMap(new HashMap(pd.length));
for (int i = 0; i < pd.length; i++) { pdMap.put(pd[i].getName(), pd[i]); }
SECTION: RI Diffs
Index:
jsf-ri/systest-per-webapp/el-performance/src/java/com/sun/faces/systest/EvaluatorBean.java
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/systest-per-webapp/el-performance/src/java/com/sun/faces/systest/EvaluatorBean.java,v
retrieving revision 1.3
diff -u -r1.3 EvaluatorBean.java
—
jsf-ri/systest-per-webapp/el-performance/src/java/com/sun/faces/systest/EvaluatorBean.java
14 Oct 2004 19:53:41 -0000 1.3
+++
jsf-ri/systest-per-webapp/el-performance/src/java/com/sun/faces/systest/EvaluatorBean.java
15 Oct 2004 05:46:34 -0000
@@ -120,7 +120,7 @@
curInput.getAttributes().put("foo", "bar");
runnable = new AttributeGetRunnable(curInput, getReps(), "foo",
random, i,
- numThreads == 1 ? false: true,
- true,
System.out,
this);
@@ -220,7 +220,7 @@
if (sleepBetweenGets) {
try
{ - Thread.sleep(Math.abs(random.nextLong()) % 10); + Thread.sleep(0L, Math.abs(random.nextInt()) % 100); }
catch (InterruptedException e) {
host.getThreadOutcomes()[index] = e;
from javaserverfaces-spec.
@edburns said:
Old implementation
30000 reps
1 thread
31:15
2 threads
34:89
3 threads
31:05
5 threads
31:14
10 threads
31:25
New implementation: Collections.synchronizedMap(new HashMap());
1 thread
31:05
2 threads
30:03
3 threads
32:16
5 threads
32:147
10 threads
32:46
20 threads
31:04
40 threads
32:16
100 threads
32:56
from javaserverfaces-spec.
@edburns said:
fixed in EDR
from javaserverfaces-spec.
@edburns said:
Prepare to delete "spec" subcomponent.
from javaserverfaces-spec.
@edburns said:
Move all to 1.2
from javaserverfaces-spec.
@manfredriem said:
Closing resolved issue out
from javaserverfaces-spec.
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-45
from javaserverfaces-spec.
Marked as fixed on Thursday, March 4th 2010, 6:09:29 am
from javaserverfaces-spec.
Related Issues (20)
- CDI shortcut for search expressions HOT 2
- ActionListener and PhaseListener declared in Facelet: Injectable or not? HOT 1
- ProtectedViewException for a protectedview access while checking the OriginHeader HOT 1
- JSF 2.3 Table 5-3 JSF artifacts eligible for injection - Constructor Injection - Not supported HOT 1
- 11.4.6 should specify "search-expression-context-factory" rather than "search-expression-context-kit-factory" HOT 1
- wrong link to Mojarra on spec front page HOT 1
- JSF 2.3 spec section 2.5.2.1 typo HOT 1
- ResourceVisitOption.TOP_LEVEL_VIEWS_ONLY clarification HOT 1
- Add PartialResponseWriterWrapper HOT 3
- StringIndexOutOfBoundsException when using jsf 2.3.3 on tomcat 9.0.2 HOT 2
- Determine url of h:outputLink at click time HOT 4
- Implement cc:insertPassthroughAttributes HOT 1
- importConstants should be allowed everywhere, not only in f:metadata HOT 3
- JSF 2.3 with Java 10&11 not recognizing generic types with f:viewParam HOT 2
- Make javascript functions created by h:commandScript return a Promise HOT 1
- javax.faces.annotation.ManagedProperty websocket event incompatibility HOT 2
- Protected View Exception
- Change locale is not working HOT 1
- Replace "fat" XML responses with modern JSON/RESTful responses HOT 2
- typo in webpage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javaserverfaces-spec.