microsoft / jericho

A learning environment for man-made Interactive Fiction games.
GNU General Public License v2.0
253 stars 42 forks source link

Add load(story_file) method to FrotzEnv #35

Closed MarcCote closed 4 years ago

MarcCote commented 4 years ago

This PR adds support to load a new story file without having to recreate a new FrotzEnv instance, thus avoiding creating and loading copies of libfrotz.so. That feature helps reduce the overhead of loading different games numerous times (e.g. meta-learning across different games).

This PR also adds support to load a story file from memory in libfrotz.so.

Running tests/benchmark.py on my laptop I get a speedup of ~5.8x.

Calling FrotzEnv(905.z5) 1000 times in 6.71 secs.
Calling env.load(905.z5) 1000 times in 1.15 secs.