Improve handling of shared script entities

Started by
2 comments, last by WitchLord 10 years, 7 months ago

When the engine loads precompiled bytecode, it performs linear search from ALL types which was registered before loading. I think this is because the engine doesn't know which module has shared entity. So saving the name of module to the bytecode would allow the engine to search shared types from fewer number of the types.

Other problems of shared script entities are
  • bytecodes doesn't have information about dependencies. You need to store them to another place and load manually.
  • you need to mark all entity as shared to use them from other modules.

What do you think about it?

Advertisement

Shared entities was introduced as a mean to allow modules to interchange objects without causing dependency on which module is compiled in which order.

The module name is not part of the bytecode. You can load the same bytecode into different modules (sometimes that is necessary to get separate set of global variables).

I didn't quite get what you meant with the comments in the bullet list, so I have probably not answered what you really asked for.

There are certainly improvements that can be made. You mention the linear search of all types. This can quite easily be optimized if there is a need for it. Are you seeing performance issues with loading pre-compiled bytecode?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Sorry I was confused. Let me sort my thoughts out first.
You said that there is no need to worry about which bytecode should be loaded first. That means declaration and implementation of shared functions will be saved to every file when I save them?

Linear search of script entities may incur some performance penalties, though it's very smaller than the case of string constants.

Yes, the shared entities are saved in all byte codes to guarantee that they will function regardless of the order in which modules are loaded.

You may want to know that I have plans to make improvements to the import functionality, which currently only works for global functions. Importing entities would be different from shared entities in that the imported entity must have been compiled / loaded in a previous module for the import to work. I can't say exactly when I'll get to work on this improvement though.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement