XMLParser::getDocumentFromURI does not cache

RESOLVED DUPLICATE of bug 192794

Status

()

Core
XSLT
--
major
RESOLVED DUPLICATE of bug 192794
15 years ago
15 years ago

People

(Reporter: Sam Emrick, Assigned: peterv)

Tracking

({perf})

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.3b) Gecko/20030211
Build Identifier: Mozilla/5.0 (rv:1.3b) Gecko/20030211

Documents are supposed to be cached during the scope of one transform.
Repetitive loads of the same URI by XMLParser::getDocumentFromURI should not
result in repeated loading of the file. Unfortunatly, this appears to be broken. 
This behavior has been verified same on os/2 and linux mozilla.

Adding in a printf to this code: 

Document* XMLParser::getDocumentFromURI(const nsAString& href, Document*
aLoader, nsAString& errMsg)
{
#ifndef TX_EXE
    nsCOMPtr<nsIURI> documentURI;
    nsresult rv = NS_NewURI(getter_AddRefs(documentURI), href);
    NS_ENSURE_SUCCESS(rv, 0);
    printf("getDocumentFromURI %s \n",NS_LossyConvertUCS2toASCII(href).get());
    ....

produces this output:

getDocumentFromURI file:///xxx/test10/statictest/haf/xsl/ui_optim.xsl 
getDocumentFromURI file:///xxx/test10/statictest/cui/xml/demographicsPDF.xml 
getDocumentFromURI file:///xxx/test10/statictest/haf/params/commonLabels.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/params/labels_en.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/params/menu.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/params/labels_en.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/params/toolbar.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/params/toolbar.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/edLevelRDRS.xml 
getDocumentFromURI file:///xxx/test10/statictest/cui/resources/lookupFileKeyed.xml

Not sure how it plays into this,.... but from the system level trace, I can see
a couple of 'curiosities'....

1) There are two threads involved here,  thread #1 is issue file opens, thread
#4 issues reads and close,...
    Thread #1 issues another open to the file before thread #4 closes the
previous file open instance
       (for this reason, the read 'bounces' back and forth from file handle 14,
15, 14, 15, )

2) The read code seems to 'stutter' and needs to get back a read of zero bytes
TWICE to 'notice' it has reached end of file... 

Here's a snippit of the os/2 system level trace:

  delta       time           PID  TID    hook name

 0.0142  1933.2083   0044 0004    DosClose
 0.0659  1933.2742   0044 0004 Dos32Read FileHandle=00000014
 0.0079  1933.2821   0044 0004    Dos32Read BytesRead=000001D7   ReturnCode=00000000
 0.0510  1933.3331   0044 0004 Dos32Read FileHandle=00000014
 0.0014  1933.3345   0044 0004    Dos32Read BytesRead=00000000   ReturnCode=00000000
 0.6290  1933.9635   0044 0004 Dos32Read FileHandle=00000014
 0.0023  1933.9658   0044 0004    Dos32Read BytesRead=00000000   ReturnCode=00000000
 6.4469  1940.4127   0044 0001 DosOpen2
FileName=D:\hsbc\statictest3\cui\resources\edLevelRDRS.xml
 0.0543  1940.4670   0044 0001    DosOpen2 FileHandle=00000015
 0.2207  1940.6877   0044 0004 DosClose FileHandle=00000014
 0.0140  1940.7017   0044 0004    DosClose
 0.0699  1940.7716   0044 0004 Dos32Read FileHandle=00000015
 0.0078  1940.7794   0044 0004    Dos32Read BytesRead=000001D7   ReturnCode=00000000
 0.0521  1940.8315   0044 0004 Dos32Read FileHandle=00000015
 0.0013  1940.8328   0044 0004    Dos32Read BytesRead=00000000   ReturnCode=00000000
 0.6106  1941.4434   0044 0004 Dos32Read FileHandle=00000015
 0.0019  1941.4453   0044 0004    Dos32Read BytesRead=00000000   ReturnCode=00000000
 5.9274  1947.3727   0044 0001 DosOpen2
FileName=D:\hsbc\statictest3\cui\resources\edLevelRDRS.xml
 0.0539  1947.4266   0044 0001    DosOpen2 FileHandle=00000014
 0.2294  1947.6560   0044 0004 DosClose FileHandle=00000015
 0.0143  1947.6703   0044 0004    DosClose
 0.0686  1947.7389   0044 0004 Dos32Read FileHandle=00000014
 0.0082  1947.7471   0044 0004    Dos32Read BytesRead=000001D7   ReturnCode=00000000
 0.0521  1947.7992   0044 0004 Dos32Read FileHandle=00000014
 0.0013  1947.8005   0044 0004    Dos32Read BytesRead=00000000   ReturnCode=00000000
 0.6130  1948.4135   0044 0004 Dos32Read FileHandle=00000014

To:	Jonas Sicking <jonas@sicking.cc>



Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Updated

15 years ago
Keywords: perf
->XSLT
Assignee: heikki → peterv
Component: XML → XSLT
QA Contact: ashishbhatt → keith
(Assignee)

Comment 2

15 years ago
Please try with a later build.

*** This bug has been marked as a duplicate of 192794 ***
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.