Skip to content

Commit

Permalink
Merge branch 'main' into feat/infer-args-name-llm
Browse files Browse the repository at this point in the history
  • Loading branch information
beelchester authored Sep 15, 2024
2 parents 33a48b8 + d02b6e6 commit fd79814
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 705 deletions.
39 changes: 8 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ cache_control = "0.2.0"
nom = "7.1.3"
exitcode = "1.1.2"
resource = "0.5.0"
stripmargin = "0.1.1"
num_cpus = "1.16.0"
fnv = "1.0.7"
futures-channel = { version = "0.3.30" }
Expand Down Expand Up @@ -156,8 +155,6 @@ tailcall-macros = { path = "tailcall-macros" }
tailcall-tracker = { path = "tailcall-tracker", optional = true }
tailcall-typedefs-common = { path = "./tailcall-typedefs-common" }
tonic-types = "0.12.1"
datatest-stable = "0.2.9"
tokio-test = "0.4.4"
base64 = "0.22.1"
tailcall-hasher = { path = "tailcall-hasher" }
serde_json_borrow = "0.6.0"
Expand All @@ -167,11 +164,11 @@ pathdiff = "0.2.1"
num = "0.4.3"
indenter = "0.3.3"
derive_more = { workspace = true }
enum_dispatch = "0.3.13"
strum = "0.26.2"
maplit = "1.0.2"

[dev-dependencies]
datatest-stable = "0.2.9"
tokio-test = "0.4.4"
tailcall-prettier = { path = "tailcall-prettier" }
criterion = "0.5.1"
httpmock = "0.7.0"
Expand All @@ -180,7 +177,6 @@ stripmargin = "0.1.1"
markdown = "1.0.0-alpha.17"
insta = { workspace = true }
tempfile = "3.10.1"
temp-env = "0.3.6"
maplit = "1.0.2"
tailcall-fixtures = { path = "./tailcall-fixtures" }
http-cache-semantics = { version = "1.0.1", default-features = false, features = [
Expand Down
12 changes: 6 additions & 6 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/cli/javascript/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ fn qjs_print(msg: String, is_err: bool) {
}
}

static CONSOLE_JS: &[u8] = include_bytes!("shim/console.js");

fn setup_builtins(ctx: &Ctx<'_>) -> rquickjs::Result<()> {
ctx.globals().set("__qjs_print", js_qjs_print)?;
let _: Value = ctx.eval_file("src/cli/javascript/shim/console.js")?;
let _: Value = ctx.eval(CONSOLE_JS)?;

Ok(())
}

impl LocalRuntime {
fn try_new(script: blueprint::Script) -> anyhow::Result<Self> {
impl TryFrom<blueprint::Script> for LocalRuntime {
type Error = anyhow::Error;

fn try_from(script: blueprint::Script) -> Result<Self, Self::Error> {
let source = script.source;
let js_runtime = rquickjs::Runtime::new()?;
let context = Context::full(&js_runtime)?;
context.with(|ctx| {
let _: () = context.with(|ctx| {
setup_builtins(&ctx)?;
ctx.eval(source)
})?;
Expand Down Expand Up @@ -126,7 +130,7 @@ fn init_rt(script: blueprint::Script) -> anyhow::Result<()> {
// exit if failed to initialize
LOCAL_RUNTIME.with(move |cell| {
if cell.borrow().get().is_none() {
LocalRuntime::try_new(script).and_then(|runtime| {
LocalRuntime::try_from(script).and_then(|runtime| {
cell.borrow().set(runtime).map_err(|_| {
anyhow::anyhow!("trying to reinitialize an already initialized QuickJS runtime")
})
Expand Down
2 changes: 1 addition & 1 deletion tailcall-cloudflare/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
hyper = { version = "0.14.28", default-features = false }
worker = "0.3.0"
worker = "0.4.0"
tailcall = { path = "..", default-features = false }
lazy_static = "1.4.0"
anyhow = "1.0.82"
Expand Down
Loading

1 comment on commit fd79814

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 14.17ms 5.02ms 142.94ms 78.86%
Req/Sec 1.79k 236.61 2.26k 75.58%

213251 requests in 30.02s, 1.07GB read

Requests/sec: 7103.49

Transfer/sec: 36.46MB

Please sign in to comment.