intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Dec 10, 2018 6:09 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu May 31, 2018 6:13 am 
Offline

Joined: Wed Nov 12, 2014 5:20 pm
Posts: 199
I recently adapted Numbered Disambiguation Choices by Aaron Reed to support rooms as well as things, and noticed that this line causes a substantial performance hit:
Code:
Understand the disambiguation id property as describing a room.
(The disambiguation id is a number property that every room and thing has.)

I was wondering if anyone could shed some light on why this is so slow, and if anyone has any ideas about how to make it faster. I guess it causes a lot of extra work for the parser. Would it be possible to somehow use a dictionary word address rather than a number, and then create dictionary words for, say, '1' to '20', unless they already exist?

EDIT: I tried replacing the line above with a lot of
Code:
Understand "1" as a room when the disambiguation id of the item described is 1.
and so on, but that turned out to be much slower.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 31, 2018 9:34 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5832
You can try using a KOV instead of a number for the disambiguation ID:

Code:
A disvalue is a kind of value. The disvalues are s0, s1, s2, s3, s4.
Understand "0" as s0.
Understand "1" as s1.
Understand "2" as s2.
Understand "3" as s3.
Understand "4" as s4.

A thing has a disvalue.
Understand the disvalue property as describing a thing.


This should be somewhat faster, although I7's flexible object-naming is never super-efficient.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 31, 2018 10:50 am 
Offline

Joined: Wed Nov 12, 2014 5:20 pm
Posts: 199
Yay, that was faster. 46,195,328 cycles saved in a full playthrough! Thanks a lot!

EDIT: I committed the implementation here.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group