1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-12 15:43:06 +00:00
openmw/components/esm3
AnyOldName3 15162a734d Avoid IO in resolveParentFileIndices
In the olden days, we passed it a vector of open ESMReader instances, as they knew the filenames and sizes, so were a convenient source of this knowledge.

When the ReadersCache was introduced as a pool of readers to limit the maximum number of simultaneously open file handles (to avoid going over the OS' limit) it was a poor substitute.
* We iterate over all the earlier readers in order in a double loop, which is the worst case scenario for an LRU pool as once we're past the size limit, we're guaranteed maximum thrashing - the least recently used item is the most likely to be used next, so the worst to evict.
* We didn't want to read any ESM files, just know whether they'd been read and what their sizes were, so didn't want to open a file handle, which the ReadersCache forced us to do.

Obviously, opening lots of file handles isn't fast, and as this was an operation done for each content file which iterated over the file's masters and within that loop iterated over every loaded file, that's O(n^3) complexity in the worst case, and for things like delta plugin merged plugins, they hit the worst case in long load orders.

This resolves the freeze reported as https://gitlab.com/OpenMW/openmw/-/issues/8425, but there may be other freezes on launch.
2025-04-10 16:16:19 +01:00
..
activespells.cpp Convert constant effect equipment slots to refnums 2024-05-24 16:59:48 +02:00
activespells.hpp Remove unused member mStackable 2024-03-26 14:44:02 +00:00
aipackage.cpp Use ESM::decompose to handle ENAMstruct 2024-02-24 14:03:24 +01:00
aipackage.hpp Use decompose to handle AI packages and data 2024-02-11 22:06:58 +01:00
aisequence.cpp Write AiSequence and Script data field by field via decompose function 2024-01-14 23:04:56 +01:00
aisequence.hpp Split ESM headers 2024-05-03 01:55:20 +02:00
animationstate.cpp Drop support for save game format 3 2023-12-09 18:05:57 +01:00
animationstate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
cellid.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
cellid.hpp Replace explicitly sized reads in cellid, cellref 2023-08-08 21:41:44 +02:00
cellref.cpp Use blank CellRef as default 2024-08-30 20:46:56 +02:00
cellref.hpp Use blank CellRef as default 2024-08-30 20:46:56 +02:00
cellstate.cpp Move TimeStamp to ESM3 and remove sized reads 2023-07-30 11:37:32 +02:00
cellstate.hpp Move TimeStamp to ESM3 and remove sized reads 2023-07-30 11:37:32 +02:00
containerstate.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
containerstate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
controlsstate.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
controlsstate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
creaturelevliststate.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
creaturelevliststate.hpp Use more fixed size integers 2023-10-24 17:23:54 +02:00
creaturestate.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
creaturestate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
creaturestats.cpp Drop support for save game format 2 2023-12-09 17:45:42 +01:00
creaturestats.hpp Use more fixed size integers 2023-10-24 17:23:54 +02:00
custommarkerstate.cpp Gets rid of most ESM::CellId 2023-04-03 14:16:05 +02:00
custommarkerstate.hpp Removes most cellId.hpp include, simplifies id generation for cells. 2023-04-03 14:16:32 +02:00
debugprofile.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
debugprofile.hpp Use more fixed size integers 2023-10-24 17:23:54 +02:00
dialoguecondition.cpp Fix editor oddities 2024-04-12 18:32:47 +02:00
dialoguecondition.hpp Fix editor oddities 2024-04-12 18:32:47 +02:00
dialoguestate.cpp Drop support for save game format 0 (pre 0.37) 2023-12-01 16:37:29 +01:00
dialoguestate.hpp create a specific esm reader function for RefID to avoid allocation for string and then again for RefId 2022-12-27 19:15:57 +01:00
doorstate.cpp Remove redundant quotes 2023-04-03 11:28:03 +04:00
doorstate.hpp Use more fixed size integers 2023-10-24 17:23:54 +02:00
effectlist.cpp Fix msvc warnings 2025-03-09 17:55:17 +01:00
effectlist.hpp Spellcast related Lua API + spellcasting/activespell refactor 2024-03-25 13:50:23 +00:00
esmreader.cpp Avoid IO in resolveParentFileIndices 2025-04-10 16:16:19 +01:00
esmreader.hpp Use more decomposition, string_view, and implicit sizes in ESM code 2024-03-23 12:15:09 +01:00
esmwriter.cpp Use more decomposition, string_view, and implicit sizes in ESM code 2024-03-23 12:15:09 +01:00
esmwriter.hpp Use more decomposition, string_view, and implicit sizes in ESM code 2024-03-23 12:15:09 +01:00
filter.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
filter.hpp Use more fixed size integers 2023-10-24 17:23:54 +02:00
fogstate.cpp Save interior fog bounds center to preserve rotation when expanding them 2024-11-24 11:49:33 +01:00
fogstate.hpp Save interior fog bounds center to preserve rotation when expanding them 2024-11-24 11:49:33 +01:00
formatversion.hpp Save interior fog bounds center to preserve rotation when expanding them 2024-11-24 11:49:33 +01:00
globalmap.cpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
globalmap.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
globalscript.cpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
globalscript.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
infoorder.hpp Fix use after move in InfoOrder::insertInfo 2023-07-30 13:37:53 +02:00
inventorystate.cpp Move local variables in components 2024-01-19 16:01:48 +04:00
inventorystate.hpp Drop support for save game format 2 2023-12-09 17:45:42 +01:00
journalentry.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
journalentry.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
landrecorddata.hpp Add unit tests for saving and loading ESM3 Land 2024-06-07 00:22:24 +02:00
loadacti.cpp Replace ESM::RefId::sEmpty by default constructed RefId where possible 2023-02-18 01:07:15 +01:00
loadacti.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadalch.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadalch.hpp Implement auto calculated potion values 2024-03-02 12:45:48 +01:00
loadappa.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadappa.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadarmo.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadarmo.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadbody.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadbody.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadbook.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadbook.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadbsgn.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
loadbsgn.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadcell.cpp Use getSubComposite to read AMBI 2024-03-14 17:08:23 +01:00
loadcell.hpp Cleanup(loadcell): Rename setHasWater to setHasWaterHeightSub 2024-02-22 03:26:17 -06:00
loadclas.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadclas.hpp Fix misspelling 2023-11-16 07:36:40 -06:00
loadclot.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadclot.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadcont.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadcont.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadcrea.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadcrea.hpp Replace more sized reads 2023-09-13 21:51:42 +02:00
loaddial.cpp Add a test and address feedback 2024-10-06 11:32:24 +02:00
loaddial.hpp Store original string id for Dialogue records 2023-03-26 19:07:32 +02:00
loaddoor.cpp Replace ESM::RefId::sEmpty by default constructed RefId where possible 2023-02-18 01:07:15 +01:00
loaddoor.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadench.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadench.hpp Replace more explicitly sized reads and variable width integers 2023-08-20 11:34:05 +02:00
loadfact.cpp Remove fixed size reads 2023-12-17 13:00:14 +01:00
loadfact.hpp Remove fixed size reads 2023-12-17 13:00:14 +01:00
loadglob.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
loadglob.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadgmst.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
loadgmst.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadinfo.cpp Deduplicate dialogue filter parsing 2024-04-11 22:29:33 +02:00
loadinfo.hpp Deduplicate dialogue filter parsing 2024-04-11 22:29:33 +02:00
loadingr.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadingr.hpp Replace more sized reads 2023-09-13 21:51:42 +02:00
loadland.cpp FIX: Bad rebase 2024-06-10 02:03:00 -05:00
loadland.hpp downgrade clang-format pls 2024-06-10 02:02:31 -05:00
loadlevlist.cpp Review 2024-03-21 16:18:18 +00:00
loadlevlist.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadligh.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadligh.hpp Replace more sized reads 2023-09-13 21:51:42 +02:00
loadlock.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadlock.hpp Replace more sized reads 2023-09-13 21:51:42 +02:00
loadltex.cpp Replace ESM::RefId::sEmpty by default constructed RefId where possible 2023-02-18 01:07:15 +01:00
loadltex.hpp Fix LTEX overriding and allow deletion 2024-06-03 16:42:27 +02:00
loadmgef.cpp Properly initialize local static pointers and collections 2024-09-21 13:52:43 +02:00
loadmgef.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadmisc.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadmisc.hpp Replace more sized reads and unsized ints 2023-10-06 16:44:18 +02:00
loadnpc.cpp Add getCompositeSize and handle NPC data 2024-03-06 18:16:55 +01:00
loadnpc.hpp Add getCompositeSize and handle NPC data 2024-03-06 18:16:55 +01:00
loadpgrd.cpp Add getCompositeSize and handle NPC data 2024-03-06 18:16:55 +01:00
loadpgrd.hpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadprob.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadprob.hpp Replace more sized reads and unsized ints 2023-10-06 16:44:18 +02:00
loadrace.cpp Don't use getExact to read structs 2023-12-17 15:16:32 +01:00
loadrace.hpp Remove fixed size reads 2023-12-17 13:00:14 +01:00
loadregn.cpp Improve format version in content selector 2024-01-01 18:16:58 +04:00
loadregn.hpp Use fixed size ints for Region and use an array for weather odds 2023-10-14 16:36:45 +02:00
loadrepa.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadrepa.hpp Replace more explicitly sized reads 2023-10-14 16:22:28 +02:00
loadscpt.cpp Make loading and saving script record more robust 2024-06-21 20:37:37 +02:00
loadscpt.hpp Make loading and saving script record more robust 2024-06-21 20:37:37 +02:00
loadskil.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadskil.hpp Use correct index for Athletics_SwimOneSecond 2024-02-27 19:28:51 +01:00
loadsndg.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadsndg.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadsoun.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadsoun.hpp Replace more sized reads and unsized ints 2023-10-06 16:44:18 +02:00
loadspel.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
loadspel.hpp Replace more sized reads and unsized ints 2023-10-06 16:44:18 +02:00
loadsscr.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
loadsscr.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadstat.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
loadstat.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
loadtes3.cpp Improve format version in content selector 2024-01-01 18:16:58 +04:00
loadtes3.hpp Improve format version in content selector 2024-01-01 18:16:58 +04:00
loadweap.cpp Use ESM::decompose to handle WPDTstruct 2024-02-24 16:55:58 +01:00
loadweap.hpp Use ESM::decompose to handle WPDTstruct 2024-02-24 16:55:58 +01:00
locals.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
locals.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
magiceffects.cpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
magiceffects.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
mappings.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
mappings.hpp Remove ESM:: namespace qualifier in components/esm3/ and tests 2022-04-12 02:04:24 +02:00
npcstate.cpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
npcstate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
npcstats.cpp Implement crime disposition modifier (bug 4683) 2023-12-26 14:04:23 +04:00
npcstats.hpp Implement crime disposition modifier (bug 4683) 2023-12-26 14:04:23 +04:00
objectstate.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
objectstate.hpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
player.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
player.hpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
projectilestate.cpp Remove fixed size reads 2023-12-17 13:00:14 +01:00
projectilestate.hpp Split ESM headers 2024-05-03 01:55:20 +02:00
queststate.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
queststate.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
quickkeys.cpp Drop support for save game format 0 (pre 0.37) 2023-12-01 16:37:29 +01:00
quickkeys.hpp Make QuickKey type a fixed size enum class 2023-03-21 20:53:04 +01:00
readerscache.cpp Avoid IO in resolveParentFileIndices 2025-04-10 16:16:19 +01:00
readerscache.hpp Avoid IO in resolveParentFileIndices 2025-04-10 16:16:19 +01:00
refnum.hpp Split ESM headers 2024-05-03 01:55:20 +02:00
savedgame.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
savedgame.hpp Display missing plugins upon savegame loading (feature 7608) 2023-11-18 14:12:18 +04:00
selectiongroup.cpp Feat(CS): Add definition files for selection group record type 2023-12-23 15:05:13 -06:00
selectiongroup.hpp Feat(CS): Add definition files for selection group record type 2023-12-23 15:05:13 -06:00
spelllist.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
spelllist.hpp create a specific esm reader function for RefID to avoid allocation for string and then again for RefId 2022-12-27 19:15:57 +01:00
spellstate.cpp Move local variables in components 2024-01-19 16:01:48 +04:00
spellstate.hpp Move TimeStamp to ESM3 and remove sized reads 2023-07-30 11:37:32 +02:00
statstate.cpp Drop support for save game format 0 (pre 0.37) 2023-12-01 16:37:29 +01:00
statstate.hpp Apply clang-format to code base 2022-09-22 21:35:26 +03:00
stolenitems.cpp Add functions to read and write ESM::RefId and use them 2023-02-13 22:07:58 +01:00
stolenitems.hpp create a specific esm reader function for RefID to avoid allocation for string and then again for RefId 2022-12-27 19:15:57 +01:00
timestamp.cpp Move TimeStamp to ESM3 and remove sized reads 2023-07-30 11:37:32 +02:00
timestamp.hpp Move TimeStamp to ESM3 and remove sized reads 2023-07-30 11:37:32 +02:00
transport.cpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
transport.hpp Replace fixed size writeHNT calls with decomposition 2024-03-03 19:39:19 +01:00
typetraits.hpp Store original string id for Dialogue records 2023-03-26 19:07:32 +02:00
variant.cpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
variant.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
variantimp.cpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
variantimp.hpp Use more fixed size ints 2023-10-24 19:25:52 +02:00
weatherstate.cpp Use fixed size ints for Region and use an array for weather odds 2023-10-14 16:36:45 +02:00
weatherstate.hpp Use fixed size ints for Region and use an array for weather odds 2023-10-14 16:36:45 +02:00