Skip to content

Commit 09f932a

Browse files
authored
[Elide] add elide runtime (#9097)
Adds Elide, a new polyglot runtime built on top of GraalVM. For now, JavaScript server benchmarking is added; Python and Ruby will follow later (Elide runs all three). Signed-off-by: Sam Gammon <[email protected]>
1 parent dcbfae8 commit 09f932a

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

frameworks/JavaScript/elide/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# [Elide](https://github.com/elide-dev/elide) - A fast polyglot runtime
2+
3+
## Description
4+
5+
Elide is a runtime which can execute **JavaScript**, **Ruby**, **Python**, and others, all in one package.
6+
7+
Elide is powered by [GraalVM](https://graalvm.org), which enables polyglot software design. Code units can interoperate from any supported language.
8+
9+
The test script embedded for this benchmark uses Elide's built-in HTTP intrinsic from JavaScript:
10+
11+
```javascript
12+
// access the built-in HTTP server engine
13+
const app = Elide.http;
14+
15+
// register basic handler
16+
app.router.handle("GET", "/plaintext", (request, response) => {
17+
// respond using the captured path variables
18+
response.send(200, "Hello, world!");
19+
});
20+
21+
// register a route handler
22+
app.router.handle("GET", "/json", (request, response, context) => {
23+
// respond using the captured path variables
24+
response.send(200, JSON.stringify({ message: "Hello, world!" }));
25+
});
26+
27+
// configure the server binding options
28+
app.config.port = 3000;
29+
30+
// receive a callback when the server starts
31+
app.config.onBind(() => {
32+
console.log(`Server listening at "http://localhost:${app.config.port}"! 🚀`);
33+
});
34+
35+
// start the server
36+
app.start();
37+
```
38+
39+
- [Elide Docs](https://docs.elide.dev)
40+
41+
## Test URLs
42+
43+
### Test 1: JSON Encoding
44+
45+
http://localhost:3000/json
46+
47+
### Test 2: Plaintext
48+
49+
http://localhost:3000/plaintext
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"framework": "elide",
3+
"tests": [{
4+
"default": {
5+
"json_url": "/json",
6+
"plaintext_url": "/plaintext",
7+
"port": 3000,
8+
"approach": "Realistic",
9+
"classification": "Platform",
10+
"language": "JavaScript",
11+
"flavor": "elide",
12+
"platform": "elide",
13+
"webserver": "None",
14+
"os": "Linux",
15+
"database_os": "Linux",
16+
"display_name": "elide",
17+
"versus": "nodejs"
18+
}
19+
}]
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[framework]
2+
name = "elide"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Platform"
9+
database_os = "Linux"
10+
database = "None"
11+
os = "Linux"
12+
orm = "Raw"
13+
platform = "elide"
14+
webserver = "None"
15+
versus = "nodejs"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM --platform=linux/amd64 ghcr.io/elide-dev/bench:1.0-alpha10-bench1-compat@sha256:1e679d95e18f9826c24a74d1709856849f53d3ca20c9bb25b548a8ec62424ad9 AS runtime
2+
3+
EXPOSE 3000
4+
5+
WORKDIR /app
6+
7+
COPY ./src .
8+
9+
ENV NODE_ENV=production
10+
11+
CMD ["elide", "serve", "server.js"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// access the built-in HTTP server engine
2+
const app = Elide.http;
3+
4+
// register basic handler
5+
app.router.handle("GET", "/plaintext", (request, response) => {
6+
// respond using the captured path variables
7+
response.send(200, "Hello, world!");
8+
});
9+
10+
// register a route handler
11+
app.router.handle("GET", "/json", (request, response, context) => {
12+
// respond using the captured path variables
13+
response.header("Content-Type", "application/json");
14+
response.send(200, JSON.stringify({ message: "Hello, world!" }));
15+
});
16+
17+
// configure the server binding options
18+
app.config.port = 3000;
19+
20+
// receive a callback when the server starts
21+
app.config.onBind(() => {
22+
console.log(`Server listening at "http://localhost:${app.config.port}"! 🚀`);
23+
});
24+
25+
// start the server
26+
app.start();

0 commit comments

Comments
 (0)