ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Burgess, Benjamin" <BBurg...@tiaa-cref.org>
Subject Ant StarTeam Checkout patch
Date Thu, 21 Jul 2005 14:34:39 GMT
Some time ago I contacted Steve Cohen (an ant committer who used to
maintain the Ant StarTeam tasks) about my willingness to help with these
tasks due to my current position working closely with the StarTeamSDK.
I have come up with 3 changes to be made which will more than double the
speed of these tasks.  Unfortunately, I do not have access to CVS in
order to create patch files (does someone know another way/tool to
create patches?) but due to the very small changes to be made, I will
instead reference the line numbers of the current CVS HEAD version of
the java files.  I have tested and our company has been using these
changes currently for the last 3 weeks now with complete success.

 

The current stcheckout task takes about 4 units of time for every single
file checked out.  The value of these units of time depends on your
StarTeam server setup (for us here, each unit of time is 1 second).  For
every single file checked out, the following occurs:

 

1)       (one unit of time) - Fetch the encoding property for the file

2)       (two units of time) - Perform the checkout

3)       (one unit of time) - Update the local cache with the files new
status

 

Both steps 1 and 3 can be removed safely with the following 2 changes to
code:

 

First:     StarTeam uses a populateNow method to pre-fetch the
properties of a file.  This prevents having to go back to the server for
every file to get its properties.  In the current code many properties
are pre-fetched, but the file encoding is not.  Adding it to the list of
pre-fetched properties cuts 25% off the time spent for every single
checkout that occurs.

FILE:
ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTa
sk.java

LINE:    577

CODE:  "pn.FILE_ENCODING" needs to be added to the "String[] props"

 

Second:            The File.checkout method for StarTeam takes in a
Boolean as its last argument which lets it know if you want to update
the status of the file after you perform the checkout (step three
above).  This is only useful if your program is going to be re-using the
same file object during its execution.  However, due to the (rather
ingenius) design of the CheckoutMap inner class, no StarTeam File object
will be brought into focus more than once during the tasks execution.
Therefore, there is no reason to update the status.  It is simply a
waste of time to do so.  It will never be seen again anyway.  In fact,
even if you where to call the stcheckout task again, it still has to
reconnect to the server causing it to re-cache the statuses (the First
change above mentions the pre-populated properties, of which FILE_STATUS
is one of).  Perhaps I am being confusing, but the bottom line is this:
there will never be a reason to use "true" as the last argument in the
checkout method due to the way the stcheckout task was designed.
Changing this saves an additional 25% of time spent for every checkout
that occurs.

FILE:
ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamChe
ckout.java

LINE:    553

CODE:  last argument changed from "true" to "false"

 

The last change in code is the issue that originally brought me in
contact with the Ant dev community.  There are two basic types of
StarTeam checkouts with the Ant tasks; forced and unforced.

An unforced checkout is used by developers on their local machines in
order to make sure they have the latest code that has been checked in by
any other team members.  It will only checkout the files whose status is
OUTOFDATE or MISSING.  However any files whose status is reported as
MODIFIED or MERGE or UNKNOWN will not be checked out as this could
overwrite local work that has been done on the files.  Also, files with
the CURRENT status will not be checked out as the local version is an
exact copy of what's in the server (so re-checking out an exact copy of
what you already have is silly and a huge waste of time).

A forced checkout is used by automated scripts on build machines and
servers in order to sync the local folder with what is on the server.
Therefore files are checked out regardless of their status.  The problem
is that even files with the Status CURRENT are checked out.  In a
continuous build scenario using forced checkouts, 90% or more of the
time spent to checkout a project is wasted on re-checking out files that
are already CURRENT.  The last code change fixes this so that files that
are already exact copies of what is in the server can be skipped.

FILE:
ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamChe
ckout.java

LINE:    532

CODE:  add " && fileStatus != Status.CURRENT" to the if statement

 

These changes together more than double the speed of checking out a
single file as well as potentially save 90% or more of time spent to
checkout entire projects.  They should be reviewed, accepted, and
committed before the next release of Ant.

 

Ben Burgess

TIAA-CREF

 



**************************************************************
This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message