Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
349 stars 235 forks source link

Use single documentation database #1643

Open mahrud opened 4 years ago

mahrud commented 4 years ago

Fixing arguably the slowest part of installing the packages happens here: https://github.com/Macaulay2/M2/blob/1e47260755100936bafd60d64013672dedd3941f/M2/Macaulay2/m2/document.m2#L319-L323 This also leads to awkward situations:

i1 : time html help "packages provided with Macaulay2";
[lots of warnings]
     -- used 6.60568 seconds

This is even the case in v1.16, by the way, nothing new. The reason is that html TO for each of the package links in that node calls getPrimaryTag -> fetchRawDocumentation -> needsPackage, as it need to read a key from the raw documentation database.

Typically installing the packages doesn't occur often, so it's not a big deal, but apparently html TO occurs much more often in the WebApp mode, and every time a new package is involved it needs to be loaded for the reasons above, causing warnings and delays.

Using a single documentation database instead would resolve this, because then you don't need to load a new package for even tasks as simple as getPrimaryKey.

cc: @pzinn

mahrud commented 4 years ago

This absorbs #786.

DanGrayson commented 4 years ago

That might be okay, but it would have to be one database per prefix. Normally there are 2, but there might be more:

i6 : prefixPath 

o6 = {/Users/dan/Library/Application Support/Macaulay2/local/, /Users/dan/src/M2/M2.git/M2/BUILD/dan/builds.tmp/gallium-development/usr-dist/}

o6 : List
mahrud commented 4 years ago

Tying this one with #776 and #594.