It's possible to get around Harlowe's rather slow processing by using pure JavaScript. For example (goes in story JavaScript):
window.names = window.names || {
// you can group names if you wish by doing something like this.
male : ['Ben', 'Thomas', 'Jimbo', 'Nicholas', 'Arthur'],
female : ['Betty', 'Theresa', 'Jane', 'Sarah', 'Ellen'],
// this function ( `names.pick()` ) selects a random name
pick : function (gender) {
// handle the argument
gender = (typeof gender === 'string') ? gender.trim().toLowerCase() : '';
// select which name list to use
var list = (gender === 'male' || gender === 'm') ? names.male : names.female;
// return a random name from the indicated list
return list[Math.trunc(Math.random() * list.length)];
}
};
Then, to retrieve the names:
(set: $boyName to names.pick('m'))\
(set: $girlName to names.pick())\
$boyName | $girlName
This should speed up performance markedly.
I've heard that datamaps in Harlowe are destroyed and recreated basically every time they are accessed, meaning there's a lot of overhead in using them for certain things. I don't know for sure, but it's possible the same thing happens with arrays, which would mean that particularly large arrays, and doing a lot of things to them in one chunk of code, could cause similar issues. Code like this will get around that by keeping Harlowe from ever interacting with the arrays at all.