Skip to content

Commit 6bb88c5

Browse files
committed
frequent hashmap lookups reduced
1 parent 8701b72 commit 6bb88c5

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rtjscomp",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"description": "php-like server but with javascript",
55
"repository": {
66
"type": "git",

rtjscomp.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/**
3-
@preserve RTJSCOMP by L3P3, 2017-2025
3+
@preserve RTJSCOMP by L3P3, 2017-2026
44
*/
55

66
"use strict";
@@ -1032,13 +1032,14 @@ const request_handle = async (request, response, https) => {
10321032

10331033
let path_params = null;
10341034
let request_body_promise = null;
1035+
let hashmap_lookup;
10351036

10361037
if (path_aliases_reverse.has(path)) {
10371038
response.setHeader('Location', path_aliases_reverse.get(path));
10381039
throw 301;
10391040
}
1040-
if (path_aliases.has(path)) {
1041-
path = path_aliases.get(path)
1041+
if ((hashmap_lookup = path_aliases.get(path)) != null) {
1042+
path = hashmap_lookup;
10421043
}
10431044
else { // aliases with *
10441045
const path_split = path.split('/');
@@ -1133,9 +1134,9 @@ const request_handle = async (request, response, https) => {
11331134

11341135
if (
11351136
file_dyn_enabled &&
1136-
file_cache_functions.has(path)
1137+
(hashmap_lookup = file_cache_functions.get(path)) != null
11371138
) {
1138-
file_function = file_cache_functions.get(path);
1139+
file_function = hashmap_lookup;
11391140
}
11401141
else {
11411142
if (log_verbose) log(`load ${

0 commit comments

Comments
 (0)