Branch: Tag:

2016-09-12

2016-09-12 19:04:47 by Martin Nilsson <nilsson@fastmail.com>

Micro-optimization: Don't use a string of only one character as needle for has_value.

1542:    programs[fname] = no_value;       string name = program_path_to_name (fname); -  mixed n = has_value (name, ".") ? +  mixed n = has_value (name, '.') ?    resolv ((name / ".")[..<1] * ".") :    get_root_module();    if (objectp (n) && (n->is_resolv_dirnode || n->is_resolv_joinnode))
2322:    {    if (as != 'O') return 0;    if (name) { -  if (has_value (name, "|")) +  if (has_value (name, '|'))    return "joinnode(" + name + ")";    else    return name; // Let's be brief.
2363:    path = combine_path(getcwd(), path);    dirnode node = fc[path] ||    (fc[path] = dirnode(path, compilation_handler, -  name && !has_value (name, "|") && name)); +  name && !has_value (name, '|') && name));    if (sizeof(joined_modules) &&    joined_modules[0] == node) return;    joined_modules = ({ node }) + (joined_modules - ({ node }));
2412:    resolv_debug("joinnode(%O)->ind(%O) => new joinnode, fallback: %O\n",    joined_modules, index, fallback_module[index]);    return joinnode(res, compilation_handler, fallback_module[index], -  name && !has_value (name, "|") && +  name && !has_value (name, '|') &&    (name == "predef::" ? index : name + "." + index));    }