Skip to content

Instantly share code, notes, and snippets.

View andreaTP's full-sized avatar
🕳️

Andrea Peruffo andreaTP

🕳️
View GitHub Profile
@andreaTP
andreaTP / example.java
Last active August 8, 2025 11:39
quickjs4j-example
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 21
//DEPS io.roastedroot:quickjs4j:0.0.9
//DEPS io.roastedroot:quickjs4j-annotations:0.0.9
//DEPS io.roastedroot:quickjs4j-processor:0.0.9
import io.roastedroot.quickjs4j.annotations.GuestFunction;
import io.roastedroot.quickjs4j.annotations.Invokables;
import io.roastedroot.quickjs4j.core.Engine;

JSR 223 in 2025

JSR 223 is a powerful specification designed to unify how Java interacts with scripting and polyglot engines. However, it was conceived many years ago, targeting early cross-language concerns. Today’s needs have evolved and we require a modern, expressive, simple, and shared API for accessing polyglot engines from Java.

Current shortcomings

Although widely implemented, JSR 223’s usefulness is hampered by optional APIs like Compilable and Invocable. To use them, developers must resort to unsafe casting, which creates leaky abstractions.

Title: WASM in the Enterprise: Secure, Portable, and Ready for Business

Speaker: Andrea Peruffo

Abstract: WebAssembly (WASM) is emerging as a powerful tool beyond its browser origins, enabling safer, more flexible, and more efficient execution across a wide range of enterprise applications.

In this session, we’ll take a hands-on look at real-world use cases, including:

// TODO: clean this up
// starts, ends but does nothing, need to dig down!
// TODO: note to self:
// try to run this example first:
// https://github.com/WebAssembly/threads/blob/b2567bff61ee6fbe731934f0ed17a5d48dc9ab01/proposals/threads/Overview.md#example
@Test
@Timeout(value = 30, unit = MINUTES)
@Disabled
public void runProtoc() throws Exception {
var store = new Store();
@andreaTP
andreaTP / gist:da9ceaaa20b72d84fb07cc0d1471891c
Created October 23, 2024 16:58
Chicory tech debt notes
- perf: how to run JMH and how to access CI results in Docs (move from folder)
- module system -> Edoardo TODO
- `aot` Readme in docs
- note design document of AOT compiler
- `WASMModule` rename as Module clash with `java.lang.Module`
- `ConstantEvaluator` -> use `long` instead of `Value`
- `CtrlFrame` -> verify how to minimize the data -structure -> e.g. use only one int for start/end (they should be mutually exclusive)
- `MemoryLimits` -> Instance with Memory factory
- re-use `FunctionType` -> verify usages around
- `Imports` mapping -> namespace + name is not part of the object but a pre-processsor does the mapping -> Instance doesn't treat differently "Imports" at all
[
{
"jmhVersion" : "1.36",
"benchmark" : "com.dylibso.chicory.bench.BenchmarkParsing.benchmark",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/Users/aperuffo/.sdkman/candidates/java/21.0.2-tem/bin/java",
"jvmArgs" : [
],
@andreaTP
andreaTP / pom.xml
Last active February 7, 2024 10:19
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.api</groupId>
<artifactId>github-java-sdk</artifactId>
<version>0.0.1</version>
<properties>
<kiota.libs.version>0.12.1</kiota.libs.version>
@andreaTP
andreaTP / badge-aot.svg
Last active September 1, 2025 14:24
chicory-test-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! /bin/bash
# .XXXXXXX makes it cross-compatible Mac/Linux
TMP_DIR=$(mktemp -d -t kiota.XXXXXXX)
PACKAGE_NAME="linux-x64"
if [[ $OSTYPE == 'darwin'* ]]; then
PACKAGE_NAME="osx-x64"
fi
URL="https://github.com/microsoft/kiota/releases/download/v0.11.1/${PACKAGE_NAME}.zip"
#! /bin/bash
# .XXXXXXX makes it cross-compatible Mac/Linux
TMP_DIR=$(mktemp -d -t kiota.XXXXXXX)
PACKAGE_NAME="linux-x64"
if [[ $OSTYPE == 'darwin'* ]]; then
PACKAGE_NAME="osx-x64"
fi
URL="https://github.com/microsoft/kiota/releases/download/v0.11.1/${PACKAGE_NAME}.zip"