You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Daniel Rall <dl...@apache.org> on 2002/06/13 01:11:43 UTC
[PATCH] Project.java
A more concise implementation of getProperty(String). No functional
change.
Index: Project.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.109
diff -u -u -r1.109 Project.java
--- Project.java 1 Jun 2002 12:26:37 -0000 1.109
+++ Project.java 12 Jun 2002 23:09:32 -0000
@@ -495,11 +495,7 @@
* or if a <code>null</code> name is provided.
*/
public String getProperty(String name) {
- if (name == null) {
- return null;
- }
- String property = (String) properties.get(name);
- return property;
+ return (name == null ? null : (String) properties.get(name));
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [PATCH] Project.java
Posted by Peter Donald <pe...@apache.org>.
At 04:57 PM 6/12/2002 -0700, you wrote:
> > public String getProperty(String name) {
> > - if (name == null) {
> > - return null;
> > - }
> > - String property = (String) properties.get(name);
> > - return property;
> > + return (name == null ? null : (String) properties.get(name));
> > }
>
>Does this have any speed benefits? ie, does it map down to a conditional
>move CMOV opcode on x86 so you avoid a speculation/branch misprediction
>penalty, or is it just a style thing?
Just a style thing.
Cheers,
Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
- John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [PATCH] Project.java
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Daniel Rall" <dl...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 4:11 PM
Subject: [PATCH] Project.java
> A more concise implementation of getProperty(String). No functional
> change.
>
> Index: Project.java
> ===================================================================
> RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
> retrieving revision 1.109
> diff -u -u -r1.109 Project.java
> --- Project.java 1 Jun 2002 12:26:37 -0000 1.109
> +++ Project.java 12 Jun 2002 23:09:32 -0000
> @@ -495,11 +495,7 @@
> * or if a <code>null</code> name is provided.
> */
> public String getProperty(String name) {
> - if (name == null) {
> - return null;
> - }
> - String property = (String) properties.get(name);
> - return property;
> + return (name == null ? null : (String) properties.get(name));
> }
Does this have any speed benefits? ie, does it map down to a conditional
move CMOV opcode on x86 so you avoid a speculation/branch misprediction
penalty, or is it just a style thing?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>