delay loading spellchecker

RESOLVED WORKSFORME

Status

P3
normal
RESOLVED WORKSFORME
18 years ago
14 years ago

People

(Reporter: cathleennscp, Assigned: cathleennscp)

Tracking

Trunk
mozilla0.9.2
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

18 years ago
in effert to improve startup performance.
we need to load as less as possible
(Assignee)

Updated

18 years ago
Blocks: 71781

Comment 1

18 years ago
So what exactly do we have to do to make this happen? Spellcheckers are only
created when first invoked, so I thought the library wasn't loaded until we
actually did a CreateInstance?
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla0.9.2

Comment 2

18 years ago
Hey kin, we put a bunch of printf()'s into the PR_LoadLibrary(), stuff, and IIRC
saw that the spellchecker was like the 4th DLL loaded. I'm pretty sure that we
saw this on the second load of a packaged, optimized win32 build; cathleen can
verify. Cathleen, maybe attach your patches to NSPR here so that kin can try 'em?
(Assignee)

Comment 3

18 years ago
I tried running again the build on my machine... and oddly enough, I'm not 
seeing spellchecker.dll getting loaded now.  I need to figure out what has 
changed since my last run.

Following was the part of the result file I generated, from previous run:

load Y:\ns\dist\WIN32_D.OBJ\bin\components\xpinstal.dll 559084000 559455000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\MyService.dll 559485000 559535000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\fullsoft.dll 559585000 559625000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\spellchecker\spellchecker.dll 
559635000 559725000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\qfaservices.dll 559735000 559765000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\nsart.dll 559765000 560296000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\activation.dll 560306000 560466000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\n2p.dll 560486000 560536000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\IMGlue.dll 560536000 560897000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\alchrdet.dll 560917000 560977000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\nsAB4xUpgrader.dll 560987000 
561077000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\aimstat.dll 561077000 561107000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\absyncmj.dll 561117000 561147000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\jsloader.dll 561247000 561287000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xpc3250.dll 561347000 561397000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\caps.dll 561417000 561457000
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xppref32.dll 561457000 561487000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\embedcomponents.dll 562309000 
562359000 
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xmlextras.dll 562359000 562409000
...
...

This is my patch:

Index: prlink.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/linking/prlink.c,v
retrieving revision 3.34.2.8
diff -u -r3.34.2.8 prlink.c
--- prlink.c	2000/12/29 21:40:49	3.34.2.8
+++ prlink.c	2001/05/07 22:10:03
@@ -461,15 +461,47 @@
             return NULL;
     }
 }
+
+
+static void pr_timehelper (const char *action, const char* filename, PRTime 
*time1, PRTime *time2)
+{
+  PRTime begin = *time1;
+  PRTime end = *time2;
+  PRTime lap = end-begin;
+  PRFloat64 seconds;
+  PRFloat64 conv;
+
+  PRFileDesc *outFile = PR_Open("startup_data.txt", PR_WRONLY | PR_CREATE_FILE 
| PR_APPEND, 0644);
+  PR_Seek(outFile, 0, PR_SEEK_END);  // PR_Apend doesn't work
+
+  LL_L2D(conv, 1000000L);
+  LL_DIV(seconds, lap, conv); 
+  PR_fprintf(outFile, "%s %s %lld %lld took %f seconds\n", action, filename, 
begin, end, seconds);
+  PR_Close(outFile);
+
+  return;
+}
+
             
 PR_IMPLEMENT(PRLibrary*) 
 PR_LoadLibrary(const char *name)
 {
     PRLibSpec libSpec;
+    PRLibrary* rv;
+    PRTime begin = 0;
+    PRTime end = 0;
 
+    begin = PR_Now();
+
     libSpec.type = PR_LibSpec_Pathname;
     libSpec.value.pathname = name;
-    return PR_LoadLibraryWithFlags(libSpec, 0);
+    rv = PR_LoadLibraryWithFlags(libSpec, 0);
+
+    end = PR_Now();
+    
+    pr_timehelper("load", name, &begin, &end);
+    
+    return rv;
 }
 
 /*
(Assignee)

Comment 4

18 years ago
my new run results, which don't show spellchecker.dll gets loaded anymore...

load Y:\ns\dist\WIN32_D.OBJ\bin\components\xpinstal.dll 989022186386000 
989022187127000 took 0.741000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\MyService.dll 989022187157000 
989022187237000 took 0.080000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\fullsoft.dll 989022187287000 
989022187337000 took 0.050000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\jsloader.dll 989022187497000 
989022187547000 took 0.050000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\embedcomponents.dll 989022187627000 
989022187717000 took 0.090000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xmlextras.dll 989022187717000 
989022187778000 took 0.061000 seconds
load jsdom.dll 989022187778000 989022188529000 took 0.751000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\chardet.dll 989022188529000 
989022188619000 took 0.090000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\uconv.dll 989022188629000 
989022188829000 took 0.200000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\appshell.dll 989022188849000 
989022188989000 took 0.140000 seconds
load gkwidget.dll 989022188999000 989022189130000 took 0.131000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\rdf.dll 989022189130000 
989022189260000 took 0.130000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xppref32.dll 989022189270000 
989022189330000 took 0.060000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\xpc3250.dll 989022189330000 
989022189480000 took 0.150000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\profile.dll 989022190121000 
989022190181000 took 0.060000 seconds
load Y:\ns\dist\WIN32_D.OBJ\bin\components\necko.dll 989022190522000 
989022192504000 took 1.982000 seconds
(Assignee)

Comment 5

18 years ago
I will try to spend some more time tomorrow to investigate... possibly I did 
something in my profile which is causing me getting conflict results

Comment 6

18 years ago
FYI, Composer has some JS (function IsSpellCheckerInstalled()) that tries to 
detect if the spellchecker is installed, so that it can hide or display the 
spellchecker UI, so if you started composer during one of your test runs, this 
may have been the cause of the spellchecker.dll load that you saw?

Comment 7

18 years ago
If we've shown that the spell checker isn't getting loaded at startup, shouldn't
we close this bug?  

Comment 8

18 years ago
I didn't see the spellchecker load until I actually tried to spellcheck (that
was on Macintosh).

Reassign to cathleen to confirm that spellchecker is loading too early on
Windows or that it is loading appropriately as on Macintosh.
Assignee: kin → cathleen
Status: ASSIGNED → NEW
(Assignee)

Comment 9

18 years ago
I tried it again and didn't see spellchecker loaded...  don't know how I got the 
first result before, but I'm going to close this bug now.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → WORKSFORME
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.